nginx 502错误: recv() failed (104: Connection reset by peer) 修复

今天登陆博客编辑文章时,忽然发现每次提交后nginx都会报502错误,查看nginx的error log发现以下信息


recv() failed (104: Connection reset by peer) while reading response header from upstream

大意应该是连接被重置造成的问题,接下来进一步去看php-fpm的error_log,发现以下log日志


[10-Mar-2017 11:16:00] WARNING: [pool www] child 23579 exited with code 127 after 658.636883 seconds from start
[10-Mar-2017 11:16:00] NOTICE: [pool www] child 23645 started

大意好像是php-fpm子进程出错然后重启了,接下来去看php-fpm.conf

vim /usr/local/php7/etc/php-fpm.d/www.conf

找到pm.max_children配置,将值由原先的5改为10试一试,然后重启php-fpm服务,问题解决了。

至于为什么会有这样的原因,不是很理解,难道是最近访问我博客的人变多了?可是看access量好像也不是很多诶~

有点莫名其妙。。。。

添加新评论