我注意到我们的一台服务器在logrotate运行后才开始返回错误,即在Nginx错误日志中我可以看到:
原文链接:https://www.f2er.com/php/139080.html[error] 8501#0: *118126869 recv() Failed (104: Connection reset by
peer) while reading response header from upstream,client: xxx.yyy.zz.ww,server: www.test.com,request: “GET /index.PHP HTTP/1.1”,upstream: “fastcgi://127.0.0.1:9011”,host: “www.test.com”
我尝试添加一个postrotate动作,使PHP重新加载优雅,但错误仍在发生,我们当前的logrotate如下:
/var/log/PHP5-fpm.log { daily missingok rotate 52 compress delaycompress notifempty create 644 root root postrotate [ ! -f /var/run/PHP5-fpm.pid ] || kill -USR2 `cat /var/run/PHP5-fpm.pid` endscript }
PHP配置如下:
[www-9011] user = www-data group = www-data listen = 127.0.0.1:9011 listen.backlog = 65535 pm = ondemand pm.max_children = 50 pm.process_idle_timeout = 10s; pm.max_requests = 500 rlimit_files = 16384 chdir = / catch_workers_output = no PHP_admin_value[error_log] = /var/log/fpm-PHP.www.log PHP_admin_flag[log_errors] = on
我们正在运行ubuntu 12.04和PHP 5.3.10