Nginx   发布时间:2022-05-11  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Nginx PHP-FPM超时,负载消耗几乎为零?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一台运行在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负载(见图),我真的不知道如何解决问题.

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

配置文件在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/

大佬总结

以上是大佬教程为你收集整理的Nginx PHP-FPM超时,负载消耗几乎为零?全部内容,希望文章能够帮你解决Nginx PHP-FPM超时,负载消耗几乎为零?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: