原文地址: http://blog.jiaoz.sg/index.php/2009/09/28/nginx-to-php-fpm-over-socket/ 

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

1.<value name="listen_address">127.0.0.1:9000</value>

to this

1.<value name="listen_address">/var/run/phpfpm.sock</value>
Updating nginx

In your nginx.conf, change this:

1.fastcgi_pass 127.0.0.1:9000;

to this

1.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.