| How To Install Nginx With PHP 5.2 Support On CentOS 5.6 |
|
|
|
| How To - Nginx | |||
| Written by Christian Foronda | |||
| Friday, 01 July 2011 11:30 | |||
|
This tutorial is tested only on CentOS 5.6 but might also work on other CentOS 5 versions. This is done on a fresh install of CentOS 5.6. Update your packages: # yum -y update
Install the repo that we will use to download php-fpm package: For i386 architecture: # rpm -ivh http://centos.alt.ru/repository/centos/5/i386/centalt-release-5-3.noarch.rpm
For x86_64 architecture: # rpm -ivh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm
Install nginx: # yum -y install nginx
Install PHP5 and php-fpm: # yum -y install php php-mysql php-fpm php-suhosin
Configure nginx: # vi /etc/nginx/nginx.conf
On line 77, uncomment the following: location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
On line 81, change the line with the one below: fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
Start nginx and php5-fpm: # chkconfig nginx on # /etc/init.d/nginx start # chkconfig php-fpm on # /etc/init.d/php-fpm start
Create phpinfo script to access it from your browser: # echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/x.php
Go to your browser and access: http://localhost/x.php
Similar articles
|


