Introduction
Nginx, MySQL, and PHP can be combined together easily as a powerful solution for
serving dynamic content on the web. These three pieces of software can be
installed and configured on a FreeBSD machine to create what is known as a FEMP
stack.
In this guide, we will demonstrate how to install a FEMP stack on a FreeBSD 9.3
server. We will be installing the software using packages in order to get up and
running more quickly. These packages provide reasonable defaults that work well
for most servers.
Configure PHP
Cari :
;listen.owner = www
;listen.group = www
;listen.mode = 0660
Kemudian jadikan semuanya enable dengan cara menghapus ; .
Setelah itu Save and Close . Tekan Esc pilih > leave editor > Save .
Kita butuh php.ini dan kita bisa copy php.ini-production sebagai php.ini
Configure MySQL
Tekan Enter
Configure Nginx
user www;
worker_processes
error_log
1;
/var/log/nginx/error.log info;
events {
worker_connections
}
http {
include
default_type
access_log
mime.types;
application/octet-stream;
/var/log/nginx/access.log;
sendfile
on;
server {
listen
server_name
root
index
1024;
80;
localhost;
/usr/local/www/nginx;
index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page
500 502 503 504 /50x.html;
location = /50x.html {
root
/usr/local/www/nginx-dist;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
Tambahkan user www; dan cek nilai untuk worker_processes x; dengan perintah
sysctl hw.ncpu
Save
Check Syntax nginx apakah sudah benar, nginx t . Jika sudah benar, maka restart
nginx.
http://ip_servermu/info.php