Powered By Blogger

Thursday, 3 April 2014

PHP-FPM Listen On Unix Socket-Ubuntu 12.04

 




  
      In the default configuration  PHP FPM is set to listen on TCP port 9000 on address 127.0.0.1.
This can be changed in /etc/php5/fpm/pool.d/www.conf

Edit the line " listen = 127.0.0.1:9000" and change it to something like  
          listen = /var/run/php5-fpm.sock.
 *you can choose different location if required



Make sure that file php5-fpm.sock is created automatically in
"/var/run ".


Dont create this file manually.


Edit Nginx configs to tell it to pass requests through the unix socket rather than TCP.


For that create a file at /etc/nginx/conf.d/ named php5-fpm.conf:
upstream php5-fpm-sock {
    server unix:/var/run/php5-fpm.sock;
}
 
After doing so, restart PHP FPM:

 sudo /etc/init.d/php5-fpm restart
 

No comments:

Post a Comment