nginx 中 fastcgi_pass设置为监听unix socket 比监听tcp socket 执行效率高
作者:csuper
发表于:2016-12-29
官方有如下说明:

; 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
astcgi_pass unix:/tmp/php-cgi.sock 这是放在磁盘
fastcgi_pass 127.0.0.1:9000
unix socket会更加快一点,不走网络 另外放在/tmp目录不如放在内存里面 我一般放在 /dev/shm/php-fpm.sock 放在内存读取速度快更快的
查看效果:
ls -al /dev/shm
版权声明
本文仅代表作者观点,不代表Csuper立场。
本文系作者授权百度百家发表,未经许可,不得转载。