【问题标题】:502 Bad Gateway Nginx502 坏网关 Nginx
【发布时间】:2013-08-14 08:47:01
【问题描述】:

已编辑:此错误仅在我使用 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"

【问题讨论】:

  • 尝试使用 tcpdump 捕获原始 http 数据并找出哪些标头太大。
  • 您可以通过调整 proxy 值来修复它,例如 this page

标签: linux nginx


【解决方案1】:

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

验证你是否没有监听套接字。

纳米/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

【讨论】:

    猜你喜欢
    • 2014-01-25
    • 2017-06-23
    • 2019-10-03
    • 2020-11-12
    • 2021-03-29
    • 2019-06-07
    • 2019-05-19
    • 1970-01-01
    • 2012-08-15
    相关资源
    最近更新 更多