Nginx to php-fpm over socket
Just changed my php-fpm / nginx config to use socket instead of tcp/ip, as both of them are running from the same host anyway.
The result is a much faster response time for the php-driven web pages. It’s almost instant!
The changes are really simple.
Updating php-fpm
in /etc/php/php-fpm.conf (your path may be different from mine):
change this
<value name="listen_address">127.0.0.1:9000</value>
to this
<value name="listen_address">/var/run/phpfpm.sock</value>
Updating nginx
In your nginx.conf, change this:
fastcgi_pass 127.0.0.1:9000;
to this
fastcgi_pass unix:/var/run/phpfpm.sock;
That’s it !
You can use another path or file name for the socket. But it shall be the same in both configuration files.