Linux 第502话
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11237241/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
502 Bad Gateway Nginx
提问by Di Wu
Edited: This error only occurs when I'm using Chrome. If I switch to Safari or FireFox, my server code works OK.
已编辑:此错误仅在我使用 Chrome 时发生。如果我切换到 Safari 或 FireFox,我的服务器代码工作正常。
Here's the error log. Please help. I'm playing with the Google OAuth 2.0 API and there's something wrong after Google calls my server back.
这是错误日志。请帮忙。我正在使用 Google OAuth 2.0 API,在 Google 回拨我的服务器后出现问题。
Let me know if you need more information to diagnose. (I'm a super newbie so I've no idea what to paste here...)
如果您需要更多信息来诊断,请告诉我。(我是一个超级新手,所以我不知道在这里粘贴什么......)
Besides, 114.247.XXX.YYYis my local office IP, with which I'm browsing websites and accessing remote servers.
另外,114.247.XXX.YYY是我的本地办公IP,我用它浏览网站和访问远程服务器。
2012/06/28 09:54:08 [error] 2170#0: *21 upstream sent too big header
while reading response header from upstream, client: **114.247.XXX.YYY**,
server: my_domain_name.com, request: "GET
/login-callback/google?state=my_randomly_generated_state&code=my_google_authorization_code
HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "my_domain_name.com"
回答by workdreamer
Ok, i' had this problem too, but in every browser.
好的,我也有这个问题,但在每个浏览器中。
Validate if you are not listen a socket.
验证您是否未侦听套接字。
nano /etc/php5/fpm/pool.d/www.conf
nano /etc/php5/fpm/pool.d/www.conf
The solution for me was:
我的解决方案是:
$ sudo nano /etc/nginx/sites-available/default
server {
[...]
location ~ \.php$ {
root /your/site/root;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#IF you are using a socket change the line above for thise one:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
###to be sure validate on /etc/php5/fpm/pool.d/www.conf
####listen = 127.0.0.1:9000 #not a socket
####listen = /var/run/php5-fpm.sock #listen a socket
# add these two lines:
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
[...]
}
$sudo service nginx restart
Source: click here
来源:点击这里