[文章作者:张宴 本文版本: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服务器 | 评论(120) | 引用(0) | 阅读(221267)
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
shz Email
2022-6-28 23:21
I read that Post and got it fine and informative. Please share more like that...  online dealings
shz Email
2022-6-28 23:24
This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post.  online dealings
shz Email
2022-6-28 23:27
Please give some advice on how to achieve this kind of posts.  online dealings
shz Email
2022-6-28 23:30
Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more  online dealings
shz Email
2022-6-28 23:32
This website is remarkable information and facts it's really excellent  online dealings
shz Email
2022-6-28 23:35
Thanks a lot for one’s intriguing write-up. It’s actually exceptional. Searching ahead for this sort of revisions.  online dealings
shz Email
2022-8-4 02:41
Very informative post ! There is a lot of information here that can help any business get started with a successful social networking campaign !  online business
shz Email
2022-8-4 02:46
I see the greatest contents on your blog and I extremely love reading them.  online business
SHZZ Email
2022-8-4 02:53
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!  online business
shz Email
2022-8-4 02:54
Hello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon!  online business
shz Email
2022-8-4 02:57
I must say, I thought this was a pretty interesting read when it comes to this topic. Liked the material. . . . .  online business
marian Email Homepage
2022-9-7 17:36
I have been looking for this information for a long time, thank you very much, the information in the article has helped me a lot in my work.
jendy Email
2022-11-8 09:20
I understand that this is a site primarily for authors territorial io rather than readers, but since we all read science fiction and fantasy, it doesn't seem unreasonable to periodically check in to see what others may be reading at the moment and what inspired them to chose it.
oralie Email
2022-11-22 16:35
If each of us learns how to apply surviv io and properly study it, everything in the content can be true. Together, let's build a thriving new world. Many thanks to the banks.
Lucky cola
2024-2-7 13:40
Dive into the virtual world and embark on an unforgettable journey.  Lucky cola
分页: 6/6 第一页 上页 1 2 3 4 5 6 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]