HostOnNet Blog

php-fpm use socket

By default php-fpm listen on tcp port 9000.

It is better to use socket instead of tcp as it is less overhead.

To change, edit file

vi /etc/php/7.0/fpm/pool.d/www.conf


listen =

Replace with

listen = /var/run/php-fpm.sock

Now edit nginx config.

vi /etc/nginx/sites-enabled/yoursite.conf



replace with

fastcgi_pass  unix:/var/run/php-fpm.sock;

Now restart nginx and php-fpm

service nginx restart
service php7.0-fpm restart

Posted in Linux