IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Nginx错误:recv() failed (104: Connection reset by peer) while reading response header from upstream PHP : seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 5 total children

    songlin发表于 2015-12-16 05:17:03
    love 0

    今天松林服务器上的两个网站都打不开了,包括这个博客。现在说下解决的流程
    首先搜索了recv() failed (104: Connection reset by peer) while reading response header from upstream错误提示:

    不要使用php-fpm的request_terminate_timeout, 最好设成request_terminate_timeout=0;这个参数会直接杀掉php进程,然后重启php进程,这样前端nginx就会返回104: Connection reset by peer。
    首先编辑php-fpm.conf 默认路径:php5/etc/php-fpm.conf,搜索request_terminate_timeout 然后修改为0;
    然后重启php-fpm kill -USR2 `cat /usr/local/php5/var/run/php-fpm.pid`

    刷新网站,还是不行,基本一致loading,继续查看php错误日志。发现php没开启errorlog、
    编辑php-fpm.conf 修改参数 error_log = /logs/php-fpm.log
    重启php、刷新网站 查看php错误日志,有一条信息很多:WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 5 total children
    大致意思是子进程超过了自己定义的最大值,
    编辑php-fpm.conf 修改参数 pm.max_children = 100
    然后重启php刷新网站,连接不上mysql了。不知道什么情况,ps aux|grep mysql 发现myqsl进程没有了。然后启动mysql
    /etc/init.d/mysqld
    再访问网站,回归正常



沪ICP备19023445号-2号
友情链接