NginX (pronounced “engine x”), is a high performance web server and a reverse proxy server. This server is well-known for its low memory footprint rather than Apache. You can refer here for Nginx vs Apache Performance Benchmark result. Nginx is way too better for Apache.
Popular websites that run on Nginx are SourceForge, WordPress, and Hulu. By making Nginx run in FreeBSD, you can deliver light, efficient, powerful, stable and secure web server in a simple way.
What is PHP? I think you all already know and no need to explain further. The PHP handler we will use is FastCGI Process Manager (FPM), is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. This setup will surely deliver high-performance web service with low specs hardware.
OS: FreeBSD 8 64bit
Nginx version: 0.8.54
PHP version: 5.3.6
Website IP: 192.168.60.2
Web directory: /home/mydomain/public_html
1. Lets start by installing Nginx web server:
cd /usr/ports/www/nginx make install clean
Once installation start, it will prompt nginx module selection page. You can select any Nginx module you want, but for me, I will select following module to be compiled right away:
[X] HTTP_MODULE Enable HTTP module [X] HTTP_ADDITION_MODULE Enable http_addition module [X] HTTP_CACHE_MODULE Enable http_cache module [X] HTTP_DAV_MODULE Enable http_webdav module [X] HTTP_FLV_MODULE Enable http_flv module [X] HTTP_GEOIP_MODULE Enable http_geoip module [X] HTTP_GZIP_STATIC_MODULE Enable http_gzip_static module [X] HTTP_IMAGE_FILTER_MODULE Enable http_image_filter module [X] HTTP_PERL_MODULE Enable http_perl module [X] HTTP_RANDOM_INDEX_MODULE Enable http_random_index module [X] HTTP_REALIP_MODULE Enable http_realip module [X] HTTP_REWRITE_MODULE Enable http_rewrite module [X] HTTP_SECURE_LINK_MODULE Enable http_secure_link module [X] HTTP_SSL_MODULE Enable http_ssl module [X] HTTP_STATUS_MODULE Enable http_stub_status module [X] HTTP_SUB_MODULE Enable http_sub module [X] HTTP_XSLT_MODULE Enable http_xslt module
If you receive any prompt after that, just accept all values if you want to have a complete setup, or else select what you want, if you know what you are doing.
2. Web server installation done. Make sure Nginx is enabled by adding following line to /etc/rc.conf: