加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Nginx PHP-FPM超时,负载消耗几乎为零?

发布时间:2020-12-13 21:27:54 所属栏目:Nginx 来源:网络整理
导读:我有一台运行在Linode上的服务器,Ubuntu 10.04 LTS,Nginx 0.7.65,MySQL 5.1.41和PHP 5.3.2使用PHP-FPM. 上面有一个WordPress博客,最近更新到WordPress 3.2.1. 我没有对服务器进行任何更改(除了更新WordPress),虽然它运行正常但是几天前我开始有停机时间. 我

我有一台运行在Linode上的服务器,Ubuntu 10.04 LTS,Nginx 0.7.65,MySQL 5.1.41和PHP 5.3.2使用PHP-FPM.

上面有一个WordPress博客,最近更新到WordPress 3.2.1.

我没有对服务器进行任何更改(除了更新WordPress),虽然它运行正常但是几天前我开始有停机时间.

我试图解决问题,并检查error_log我看到许多超时和消息似乎与超时有关.服务器当前正在记录此类错误:

2011/07/14 10:37:35 [warn] 2539#0: *104 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/2/00/0000000002 while reading upstream,client: 217.12.16.51,server: www.example.com,request: "GET /page/2/ HTTP/1.0",upstream: "fastcgi://127.0.0.1:9000",host: "www.example.com",referrer: "http://www.example.com/"

2011/07/14 10:40:24 [error] 2539#0: *231 upstream timed out (110: Connection timed out) while reading response header from upstream,client: 46.24.245.181,request: "GET / HTTP/1.1",referrer: "http://www.google.es/search?sourceid=chrome&ie=UTF-8&q=example"

甚至看到this previous serverfault discussion有一个可能的解决方案:编辑/etc/php/etc/php-fpm.conf并更改

request_terminate_timeout=30s

代替

;request_terminate_timeout= 0

服务器工作了几个小时,然后再次破坏.我再次编辑文件以保持原样,并重新启动php-fpm(服务php-fpm重启)但没有运气:服务器工作了几分钟并反复回到问题.奇怪的是,虽然服务正在运行,但htop显示没有CPU负载(见图),我真的不知道如何解决问题.

enter image description here

配置文件在pastebin上

php-fpm.conf file is here

/etc/nginx/nginx.conf is here

/etc/nginx/sites-available/www.example.com is here

最佳答案
您是否尝试过在nginx.conf中执行“上游”操作,而不是执行以下操作:

# Pass PHP scripts to PHP-FPM
location ~* .php${
   try_files       $uri /index.php;
   fastcgi_index   index.php;
   fastcgi_pass    127.0.0.1:9000;
   include         fastcgi_params;
   fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
   fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

看看这里http://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips-and-tricks/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读