我看到別人的nginx
設(shè)定中 fastcgi_pass
是unix:/tmp/php-cgi.sock
而我的設(shè)定卻是127.0.0.1:9000
(不討論負(fù)載平衡什麼的,就是最簡(jiǎn)單的一個(gè)server
#)
unix:/tmp/php-cgi.sock
和127.0.0.1:9000
二者有什麼差別呢?
我在我的php-fpm.conf
看到
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
listen
的設(shè)定修改為/tmp/php-cgi.sock
嗎? 嗯,unix socket會(huì)更快一點(diǎn),不走網(wǎng)路
另外放在/tmp目錄不如放在記憶體裡面
我通常放在 /dev/shm/php-fpm.sock
放在記憶體讀取速度快更快的
理論上,unix socket不走網(wǎng)絡(luò),會(huì)快一點(diǎn),
可是,穩(wěn)定性就不那麼理想了,
這裡有人做測(cè)試,可以參考
http://blog.csdn.net/liv2005/article/details/7741732