Nginx 502 Bad Gateway错误是FastCGI有问题,造成NGINX 502错误的可能性比较多 不是我想要的 但是写的挺好
2012-12-13 18:36
645 查看
http://www.80php.com/tech/linux/20120320/413_2.html
Nginx 502 Bad Gateway错误是FastCGI有问题,造成NGINX 502错误的可能性比较多。将网上找到的一些和502 Bad Gateway错误有关的问题和排查方法列一下,先从FastCGI配置入手:
1.FastCGI进程是否已经启动
2.FastCGI worker进程数是否不够
运行 netstat -anpo | grep “php-cgi” | wc -l 判断是否接近FastCGI进程,接近配置文件中设置的数值,表明worker进程数设置太少
3.FastCGI执行时间过长
根据实际情况调高以下参数值
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
4.FastCGI Buffer不够
nginx和apache一样,有前端缓冲限制,可以调整缓冲参数
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
5.Proxy Buffer不够
如果你用了Proxying,调整
proxy_buffer_size 16k;
proxy_buffers 4 16k;
6.https转发配置错误
正确的配置方法
server_name www.linuxidc.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;
}
当然,还要看你后端用的是哪种类型的FastCGI,我用过的有php-fpm,流量约为单台机器40万PV(动
Nginx 502 Bad Gateway错误是FastCGI有问题,造成NGINX 502错误的可能性比较多。将网上找到的一些和502 Bad Gateway错误有关的问题和排查方法列一下,先从FastCGI配置入手:
1.FastCGI进程是否已经启动
2.FastCGI worker进程数是否不够
运行 netstat -anpo | grep “php-cgi” | wc -l 判断是否接近FastCGI进程,接近配置文件中设置的数值,表明worker进程数设置太少
3.FastCGI执行时间过长
根据实际情况调高以下参数值
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
4.FastCGI Buffer不够
nginx和apache一样,有前端缓冲限制,可以调整缓冲参数
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
5.Proxy Buffer不够
如果你用了Proxying,调整
proxy_buffer_size 16k;
proxy_buffers 4 16k;
6.https转发配置错误
正确的配置方法
server_name www.linuxidc.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;
}
当然,还要看你后端用的是哪种类型的FastCGI,我用过的有php-fpm,流量约为单台机器40万PV(动
相关文章推荐
- nginx 502 Bad Gateway 错误解决办法
- (总结)Nginx 502 Bad Gateway错误触发条件与解决方法
- Nginx 502 Bad Gateway 错误的解决方法
- Nginx 502 Bad Gateway错误的解决办法
- nginx 502 Bad Gateway 错误答案收集
- nginx 502 Bad Gateway 错误解决办法
- nginx加php-fpm出现502 bad gateway错误的5种解决方法
- Nginx 502 Bad Gateway错误问题收集
- nginx 502 Bad Gateway 错误问题收集
- Nginx 502 Bad Gateway 错误的原因及解决方法
- LNMP一键安装包的Nginx 502 Bad Gateway错误可能原因及解决方法
- nginx 502 Bad Gateway 错误解决办法
- nginx 502 Bad Gateway 错误解决办法
- (总结)Nginx 502 Bad Gateway错误触发条件与解决方法
- Nginx 502 Bad Gateway 的错误的解决方案
- nginx 502 Bad Gateway 错误解决办法
- nginx 502 Bad Gateway 错误问题收集
- Nginx 502 Bad Gateway 错误的原因及解决方法
- 解决Nginx + PHP(FastCGI)遇到的502 Bad Gateway错误[原创]
- 深入探讨:Nginx 502 Bad Gateway错误的解决方法