nginx报 502错误

来源:互联网 发布:认知心理学教材 知乎 编辑:程序博客网 时间:2024/05/01 04:01

查nginx日志如下:

connect() to unix:/tmp/php-cgi.sock failed

 

解决:

最终发现是因为突然的网站访问量大导致,因为子进程数不足:

到php-fpm.conf找到max_children也就是子进程最大数改为:<value name="max_children">128</value>

 

附:

1:通过命令查看服务器上一共开了多少的 php-cgi 进程


ps -fe |grep "php"|grep -v "grep"|wc -l

 

2:查看已经有多少个php-cgi进程用来处理tcp请求

 

netstat -anop |grep "php"|grep -v "grep"|wc -l

 

如果netstat -anop |grep "php"|grep -v "grep"|wc -l 这个值快接近于php-fpm.conf中的max_children值,那么需要适当调大max_children.

 

0 0
原创粉丝点击