Install nginx 0.7.63 from Source in CentOS 5.4 with PHP5 FastCGI Support
Nov 05
I am running CentOS 5.4 64-bit VM in XenServer. Please proceed to download the latest stable version nginx 0.7.63. You may read the 0.7 changelog for feature updates and bugfix. You need to download lighttpd 1.4.22 because we are configuring PHP as FastCGI. Let’s start our download as below: -
wget -c http://sysoev.ru/nginx/nginx-0.7.63.tar.gz ; wget -c http://www.lighttpd.net/download/lighttpd-1.4.22.tar.gz
Next, we need to extract the Gzip files to /tmp/sources as below: -
mkdir /tmp/sources
tar xvfz nginx-0.7.63.tar.gz -C /tmp/sources
tar xvfz lighttpd-1.4.22.tar.gz -C /tmp/sources
Then, we need to start configuring and compiling nginx as below: -
cd /tmp/sources/nginx-0.7.63
./configure –-with-http_ssl_module -–with-md5=auto/lib/md5 -–with-sha1=auto/lib/sha1
make
make install
Ok, we need to start configuring and compiling lighttpd as below: -
cd /tmp/sources/lighttpd-1.4.22
./configure
make
cp src/spawn-fcgi /usr/local/bin
Next, we need to start the spawn-fcgi for spawning FastCGI processes as below: -
/usr/local/bin/spawn-fcgi -f /usr/bin/php-cgi -a 127.0.0.1 -p 9000 -P /var/run/fastcgi-php.pid
Then, you need to edit the nginx.conf which located in /usr/local/nginx/conf as below: -
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
Now, you can test nginx by starting it using the command as below: -
/usr/local/nginx/sbin/nginx
Simply navigate to your server’s IP address and you will see the nginx welcome message also create a simple php file in /usr/local/nginx/html to include phpinfo() for testing PHP functionality.
If you found these helpful, please contribute to help:
Twitter
Facebook
Flickr
RSS
Recent Comments