[文章作者:张宴 本文版本:v1.0 最后修改:2008.07.30 转载请注明原文链接:http://blog.zyan.cc/read.php/361/]

  昨日,有朋友问我,他将Web服务器换成Nginx 0.6.31  + PHP 4.4.7(FastCGI)后,有时候访问会出现“502 Bad Gateway”错误,如何解决。

  我让按照以下两个步骤去解决,最后在第2步中将FastCGI的timeout时间增加为300,问题解决:

  PS:比较羡慕迅雷的Web服务器,16G内存。



  1、查看当前的PHP FastCGI进程数是否够用:
netstat -anpo | grep "php-cgi" | wc -l

  如果实际使用的“FastCGI进程数”接近预设的“FastCGI进程数”,那么,说明“FastCGI进程数”不够用,需要增大。



  2、部分PHP程序的执行时间超过了Nginx的等待时间,可以适当增加nginx.conf配置文件中FastCGI的timeout时间,例如:
......
http
{
......
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
......
}
......



Tags: , , , ,
技术大类 » Web服务器 | 评论(105) | 引用(0) | 阅读(185389)
hcl Email
2013-10-31 18:51
张老师,我也出现502的错误,经过排查,发现是apc的问题,我用把yii应用部署到网站上面,这个问题就出来,把apc关掉,就ok,PHP 5.4.21 apc是是最新的
django Email Homepage
2013-11-30 19:21
Uggs Sale the ideal idea Coach Outlet Online  enough time to search for many of reduction Ugg boot. Like big portions? If you began ready your apartment, Coach Outlet  it's always best to consider the most effective way direct to the stage it could be to utilise your inventory throughout Coach Factory Outlet  concern, or maybe you basically won't destination stuff not enough.we're anti- whitening tray because Coach Outlet Online  i will be enjoy just get germ dog breeders
chares
2015-5-13 16:10
fastcgi_connect_timeout 300;
官方文档好像规定这个不能大于75秒

http://wiki.nginx.org/HttpFastcgiModule#fastcgi_connect_timeout

fastcgi_connect_timeout
Syntax:   fastcgi_connect_timeout time
Default:   60s
Context:   http
server
location
Reference:  fastcgi_connect_timeout

Directive sets timeout period for connection with FastCGI-server. It should be noted that this value can't exceed 75 seconds.
dsdds Email Homepage
2016-2-1 17:08
sddsdsds
分页: 6/6 第一页 上页 1 2 3 4 5 6 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]