您的位置:首页 > 运维架构 > Nginx

Nginx 502 Bad Gateway错误问题收集

2013-04-08 16:45 405 查看
nginxlighttpd的文档真的很少,更不用说中文文档了,所以收集一些和502有关的错误在这里。
502是FastCGI出现问题,所以从FastCGI配置入手。
1.请检查你的FastCGI进程是否启动
2.FastCGI进程不够使用
请通过执行 netstat -anpo | grep “php-cgi” | wc -l 判断,是否接近你启动的FastCGI进程,接近你的设置,表示进程不够
3.执行超时
请把
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
这几项的值调高
4.FastCGI缓冲不够
nginxapache一样,有前端缓冲限制
请把
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
这几项的值调高
5.Proxy缓冲不够
如果你使用了Proxying,请把
proxy_buffer_size 16k;
proxy_buffers 4 16k;
这几项的值调高
6.https转发配置错误
正确的配置方法
server_name www.mydomain.com;
location /myproj/repos {
set $fixed_destination $http_destination;
if ( $http_destination ~* ^https(.*)$ )
{
set $fixed_destination http$1;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Destination $fixed_destination;
proxy_pass http://subversion_hosts; }
7.php脚本执行时间过长
php-fpm.conf的<value name=”request_terminate_timeout”>0s</value>的0s改成一个时间。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息