502 Bad Gateway Nginx

时间:2012-06-28 02:14:38

标签: linux nginx

已修改:仅在我使用Chrome时才会出现此错误。如果我切换到Safari或FireFox,我的服务器代码可以正常工作。

这是错误日志。请帮忙。我正在使用Google OAuth 2.0 API,但Google重新调用我的服务器后出现了问题。

如果您需要更多诊断信息,请与我们联系。 (我是一个超级新手,所以我不知道在这里粘贴什么......)

此外, 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"

1 个答案:

答案 0 :(得分:1)

好的,我也有这个问题,但在每个浏览器中都有。

验证您是否不听套接字。

nano /etc/php5/fpm/pool.d/www.conf

我的解决方案是:

$ 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

来源:click here