Tuesday, April 9, 2013

Nginx-php-fpm Installation With Yum on Centos.


Install Nginx with php-FPM
 rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

yum install nginx  php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-xcache php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy

vi /etc/nginx/conf.d/domain.conf
server {
   listen 80;
   server_name www.domain domain;
   root /usr/share/nginx/html;
   location / {
       index  index.html index.htm index.php;
   }
   location ~ \.php$ {
       include /etc/nginx/fastcgi_params;
       fastcgi_pass  127.0.0.1:9000;
       fastcgi_index index.php;
       fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
   }
}

/etc/init.d/nginx restart

 /etc/init.d/php-fpm restart

You can check php-fpm if it is running
[root@yo html]# netstat -anltup | grep php-fpm
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      23249/php-fpm