Step by step install Engine X (nginx) and php-fpm in FreeBSD

Filed under BSD, phpBB, server side
Tagged as

1. Install nginx

# cd /usr/ports/www/nginx
# make install

choose :

HTTP_MODULE
HTTP_REWRITE_MODULE
HTTP_SSL_MODULE
HTTP_STATUS_MODULE
.....

2. Install php

# cd /usr/ports/lang/php5
# make install

choose :

CLI
CGI
SUHOSIN
IPV6
FASTCGI
PATHINFO
.....

3. Install php-fpm freebsd ports

# wget http://php-fpm.anight.org/downloads/freebsd-port/php-5.2.6-fpm-0.5.9.tar.gz

Extract and copy

# tar xvzf php-5.2.6-fpm-0.5.9.tar.gz
# cp -R ./php-5.2.6-fpm-0.5.9 /usr/ports/lang/php5-fpm
# cd /usr/ports/lang/php5-fpm
# make install

choose :

CLI
SUHOSIN
PATHINFO
.....

4. Configuring

update /etc/rc.conf

Add these lines :

nginx_enable="YES"
php_fpm_enable="YES"

save.

edit /usr/local/etc/nginx/nginx.conf

Find this lines in nginx.conf and adjust :

root /usr/local/www/nginx;

location / {
index index.php index.html index.htm;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
include fastcgi_params;
}

Edit /usr/local/etc/php-fpm.conf

Find these lines :

nobody –>
nobody –>

change nobody into www (or your www user)

www
www

Run the services

# /usr/local/etc/rc.d/php-fpm start
# /usr/local/etc/rc.d/nginx start

5. Testing

# cd /usr/local/www/nginx

# nano info.php

save.

done.

Compatible with Apache’s log file format

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';

FROM HERE

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Spam Protection by WP-SpamFree