[文章作者:张宴 本文版本:v1.0 最后修改:2008.07.30 转载请注明原文链接:http://blog.s135.com/read.php/361.htm]
昨日,有朋友问我,他将Web服务器换成Nginx 0.6.31 + PHP 4.4.7(FastCGI)后,有时候访问会出现“502 Bad Gateway”错误,如何解决。
我让按照以下两个步骤去解决,最后在第2步中将FastCGI的timeout时间增加为300,问题解决:
PS:比较羡慕迅雷的Web服务器,16G内存。
1、查看当前的PHP FastCGI进程数是否够用:
如果实际使用的“FastCGI进程数”接近预设的“FastCGI进程数”,那么,说明“FastCGI进程数”不够用,需要增大。
2、部分PHP程序的执行时间超过了Nginx的等待时间,可以适当增加nginx.conf配置文件中FastCGI的timeout时间,例如:
昨日,有朋友问我,他将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;
......
}
......
http
{
......
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
......
}
......
基于Sphinx+MySQL的千万级数据全文检索(搜索引擎)架构设计[原创]
利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]

2008-7-30 07:09 | by




![订阅回忆未来[张宴]的博客](http://pic1.s135.com/images/rewin/rss.gif)

netstat -an | grep "php-cgi" | wc -l
netstat -an 不是显示端口, grep php-cgi 能得到什么?
# netstat -an | grep "php-cgi" | wc -l
0
netstat -anpo | grep "php-cgi" | wc -l
502是Bad Gateway,是sock、端口没被监听造成的
1.按照你的方法配置,,但是修改php.in 的display_errors = on。。用phpinfo()看还是off的。。。已经重启并且没改错php.ini文件
2.请问下nginx怎么才能支持index.php/id/2这样的路径呢?
我发现只支持index.php?/id/2
谢谢
请问上次我问的时候,你回答的这样的,要不要再加了?
large_client_header_buffers 4 32k;
10310 daemon 15 0 7552m 2.7g 812 S 0 0.6 0:01.26 nginx
10313 daemon 15 0 75464 25m 812 S 0 0.6 0:01.23 nginx
10318 daemon 15 0 7543m 2.7g 812 S 0 0.6 0:01.31 nginx
有谁遇到过这样的问题米?
220.255.7.194 - - [20/Aug/2008:22:38:30 +0800] "-" 400 0 "-" "-" -
60.190.0.78 - - [20/Aug/2008:22:38:31 +0800] "-" 400 0 "-" "-" -
220.202.4.12 - - [20/Aug/2008:22:38:31 +0800] "-" 400 0 "-" "-" -
220.202.4.12 - - [20/Aug/2008:22:38:31 +0800] "-" 400 0 "-" "-" -
58.220.236.250 - - [20/Aug/2008:22:38:33 +0800] "-" 400 0 "-" "-" -
117.40.118.93 - - [20/Aug/2008:22:38:33 +0800] "-" 400 0 "-" "-" -
222.242.65.94 - - [20/Aug/2008:22:38:34 +0800] "-" 400 0 "-" "-" -
58.220.236.250 - - [20/Aug/2008:22:38:34 +0800] "-" 400 0 "-" "-" -
219.152.214.89 - - [20/Aug/2008:22:38:34 +0800] "-" 400 0 "-" "-" -
58.33.12.209 - - [20/Aug/2008:22:38:35 +0800] "-" 400 0 "-" "-" -
60.50.171.133 - - [20/Aug/2008:22:38:36 +0800] "-" 400 0 "-" "-" -
我用 netstat -anpo | grep "php-cgi" | wc -l 查看你 显示 1
安装过程都正常,启动nginx后显示的也是502 Bad Gateway .
php跑PHP-CGI很不稳定,快的时候真的很快,但慢起来就是 502、504
http://bbs.woyool.com
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;