Step by step install Engine X (nginx) and php-fpm in FreeBSD
Nginx already in my list for almost 3 month but I don’t have time for play around with it. As usual freebsd ports is my preferable method to install software in FreeBSD
I’m lucky to get php-fpm ports from php-fpm site that work for php-5.2.3RC. After change it a bit for php 5.2.6 I can test it together with nginx stable from ports too.
Here’s my steps for install nginx with php-fpm using FreeBSD ports :
1. Install nginx
alamster# cd /usr/ports/www/nginx
alamster# make install
I choose :
HTTP_MODULE
HTTP_REWRITE_MODULE
HTTP_SSL_MODULE
HTTP_STATUS_MODULE
2. Install php
alamster# cd /usr/ports/lang/php5
alamster# make install
I choose :
CLI
CGI
SUHOSIN
IPV6
FASTCGI
PATHINFO
3. Install php-fpm, I choose it after see explanation from their website.
I just modify freebsd ports here to get it work with php-5.2.6.
alamster# wget http://alamster.googlepages.com/php5-fpm.5.2.6.tar.gz
–2008-08-04 01:08:10– http://alamster.googlepages.com/php5-fpm.5.2.6.tar.gz
Resolving alamster.googlepages.com… 209.85.173.118
Connecting to alamster.googlepages.com|209.85.173.118|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 11461 (11K) [application/octet-stream]
Saving to: `php5-fpm.5.2.6.tar.gz’
100%[======================================>] 11,461 6.05K/s in 1.8s
2008-08-04 01:08:15 (6.05 KB/s) – `php5-fpm.5.2.6.tar.gz’ saved [11461/11461]
Extract and delete
alamster# tar xvzf php5-fpm.5.2.6.tar.gz –-directory=/usr/ports/lang && rm php5-fpm.5.2.6.tar.gz
alamster# cd /usr/ports/lang/php5-fpm/ && make install
I choose :
CLI
SUHOSIN
PATHINFO
4. Configuring
update rc.conf
alamster# ee /etc/rc.conf
Add these lines :
nginx_enable=”YES”
php_fpm_enable=”YES”
save.
Edit nginx.conf
alamster# ee /usr/local/etc/nginx/nginx.conf
Find this lines in nginx.conf and adjust :
location / {
root /usr/local/www/nginx;
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 php-fpm.conf
alamster#ee /usr/local/etc/php-fpm.conf
Find these lines :
<!– <value name=”user”>nobody</value> –>
<!– <value name=”group”>nobody</value> –>
change nobody into www
<value name=”user”>www</value>
<value name=”group”>www</value>
Run the services
alamster# /usr/local/etc/rc.d/php-fpm start
alamster# /usr/local/etc/rc.d/nginx start
5. Testing
alamster# cd /usr/local/www/nginx
alamster# ee info.php
<?php
phpinfo();
?>
save.
Open this phpinfo url and see this part to check if nginx and php-fpm in the right track :
CGI/FastCGI work as Server API
nginx/0.6.32 work as webserver.
Great, I love FreeBSD ports
Related Reading:
- php-fpm freebsd
- freebsd nginx php-fpm
- freebsd php-fpm
- run nginx freebsd
- nginx freebsd
- php fpm freebsd
- nginx php-fpm
- freebsd nginx
- nginx php-fpm freebsd
- freebsd php fpm
- freebsd nginx php
- freebs port php fpm
- php5-fpm
- nginx php fpm
- php-fpm nginx
- nginx php freebsd
- install nginx freebsd
- php5-fpm freebsd
- php fpm nginx freebsd
- php-fpm freebsd port
- php fpm nginx
- php fpm on freebsd
- howto nginx
- howto ngnix
- php-fpm
- php-fpm nginx freebsd
- freebsd nginx php fpm
- php-fpm bsd
- nginx on freebsd
- /usr/ports/www/nginx openbsd
- nginx freebsd php
- php-fpm conf nginx
- php-fpm openbsd
- install php-fpm
- php-fpm freebsd ports
- PHP-FPM freebsd install
- nginx in freebsd
- nginx php freebsd install
- nginx on freebsd 8
- install nginx in freebsd
- install php-fpm freeBSD
- php5-fpm nginx
- nginx config php-fpm
- installing nginx php on freebsd
- nginx php5-fpm
- freebsd nginx install
- freebsd phpfpm
- install php-fpm openbsd
- nginx php fpm freebsd
- ngnix php freebsd
3 Comments
Also good article how to install nginx with PHP and FastCGI under Linux is here http://www.linuxspace.org/archives/1576
I used it of my site.
Random Post
Leave Your Comments Below
FreeBSD, PF, OpenBSD Books
-
pfSense: The Definitive Guide
-
Learning FreeNAS: Configure and manage a network attached storage solution
-
The Book of PF: A No-Nonsense Guide to the OpenBSD Firewall
-
Building Firewalls with OpenBSD and PF, 2nd Edition
-
Mastering FreeBSD and OpenBSD Security
-
The Definitive Guide to PC-BSD (Expert's Voice in BSD)
-
Absolute FreeBSD: The Complete Guide to FreeBSD, 2nd Edition
-
The Complete FreeBSD: Documentation from the Source
-
The Design and Implementation of the FreeBSD Operating System
Hacking Computer Books
-
Hacking: The Art of Exploitation, 2nd Edition
-
Hacking For Dummies
-
Secrets of Computer Espionage: Tactics and Countermeasures
-
Hacking Exposed Computer Forensics, Second Edition: Computer Forensics Secrets & Solutions
-
Hacking Exposed: Network Security Secrets and Solutions, Sixth Edition
-
Gray Hat Hacking, Second Edition: The Ethical Hacker's Handbook
-
The Web Application Hacker's Handbook: Discovering and Exploiting Security Flaws
-
Hacking Wireless Networks For Dummies (For Dummies (Computer/Tech))
-
Chained Exploits: Advanced Hacking Attacks from Start to Finish
-
Professional Penetration Testing: Creating and Operating a Formal Hacking Lab
-
Ethical Hacking and Countermeasures: Threats and Defense Mechanisms (Ec-Council Press Series: Certified Ethical Hacker)
-
Ethical Hacking and Countermeasures: Secure Network Infrastructures (Ethical Hacking and Countermeasures: C/ E H: Certified Ethical Hacker)









This section:
Extract and delete
alamster# tar xvzf php5-fpm.5.2.6.tar.gz –directory=/usr/ports/lang && rm php5-fpm.5.2.6.tar.gz
Should read
alamster# tar xvzf php5-fpm.5.2.6.tar.gz –directory=…
Directory should have dbl dash.
Excellent How-To however!!