Nginx 502 Bad Gateway错误问题收集

nginx lighttpd 的文档真的很少,更不用说中文文档了,所以收集一些和 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 缓冲不够
nginx apache 一样,有前端缓冲限制
请把
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 改成一个时间。

你可能感兴趣的:(nginx,gateway,502,bad,错误问题收集)