简体   繁体   English

Nginx Web 服务器错误 - 从上游读取响应标头时,上游发送的标头太大

[英]Nginx Web Server Error - upstream sent too big header while reading response header from upstream

I have a nginx web server set up running two sites i am developing, they are basically the same site with the same config, built on Laravel framework.我有一个 nginx web 服务器设置运行我正在开发的两个站点,它们基本上是相同的站点,具有相同的配置,构建在 Laravel 框架上。 Both have a login setup but one is giving me a 502 error anytime i attempt to login.两者都有登录设置,但每次我尝试登录时都会出现 502 错误。 Anytime i attempt to login i get a 502 error and if i check the nginx error log i see the following:任何时候我尝试登录时都会收到 502 错误,如果我检查 nginx 错误日志,我会看到以下内容:

2020/10/21 22:26:59 [error] 10400#10400: *12 upstream sent too big header while reading response header from upstream, client: 162.158.179.216, server: vms2.medlab.co, request: "POST /login HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "vms2.medlab.co", referrer: "https://vms2.medlab.co/" 2020/10/21 22:26:59 [错误] 10400#10400:*12 上游在从上游读取响应头时发送了太大的头,客户端:162.158.179.216,服务器:vms2.medlab.co,请求:“POST /登录 HTTP/1.1”,上游:“fastcgi://unix:/run/php/php7.4-fpm.sock:”,主机:“vms2.medlab.co”,引荐来源:“https://vms2.medlab” .co/"

My conf file for the site is as follows, which is excactly the same as my other site which runs perfectly fine:我的站点的 conf 文件如下,这与我的其他站点完全相同,运行良好:

#http
server {
    listen         80;
    server_name    vms2.medlab.co;
    root           /var/www/vms.medlab.co/current/public;
    index          index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    location ~* \.php$ {
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_pass unix:/run/php/php7.4-fpm.sock;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

# HTTPS
server {
  listen 443 ssl http2;
  server_name vms2.medlab.co;
  root        /var/www/vms.medlab.co/current/public;
  index       index.php index.html index.htm;


  #ssl on;
  ssl_certificate         /etc/nginx/ssl/cloudflare-medlab.co.crt;
  ssl_certificate_key     /etc/nginx/ssl/cloudflare-medlab.co.key;

  location ~ /\. {
    deny all;
  }


  location / {
    access_log /var/www/vms.medlab.co/logs/access.log combined;
    error_log /var/www/vms.medlab.co/logs/error.log;
    try_files $uri $uri/ /index.php?$query_string;
  }

  location ~* \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    include         fastcgi_params;

    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
  }
}

I have found a bunch of issues people have had in regards to the fast cgi and have tried a few quick fixes but have had no luck so far.我发现人们在快速 cgi 方面遇到了很多问题,并尝试了一些快速修复,但到目前为止都没有运气。 Has nayone run into anything similar and have anything else i should try?有没有人遇到过类似的事情,还有什么我应该尝试的吗?

Thanks in advance提前致谢

chrome 中的 502 错误

Found the issue!发现问题!

Had to add the following the nginx.conf file不得不在 nginx.conf 文件中添加以下内容

    http { 
...
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_connect_timeout 90;
    fastcgi_send_timeout 90;
    fastcgi_read_timeout 90;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 上游从客户端,客户端(nginx,清漆)读取响应头时发送了太大的头 - upstream sent too big header while reading response header from upstream, client (nginx, varnish) 如何修复上游从上游读取响应头时发送过大的头? - how to fix upstream sent too big header while reading response header from upstream? 从上游读取响应标头时,上游发送了太大的标头 - upstream sent too big header while reading response header from upstream PHP 升级后的 nginx 错误:FastCGI 在 stderr 中发送:“”同时从上游读取响应标头 - nginx error after PHP upgrade: FastCGI sent in stderr: " " while reading response header from upstream 错误28105#0:* 1 stderr发送的FastCGI:从上游读取响应头时“主脚本未知” - error 28105#0: *1 FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream 如何调试“FastCGI sent in stderr: Primary script unknown while reading response header from upstream”并找到实际的错误消息? - How to debug "FastCGI sent in stderr: Primary script unknown while reading response header from upstream" and find the actual error message? 从上游读取响应标头时,在未知的 stderr 主脚本中发送的 FastCGI - FastCGI sent in stderr primary script unknown while reading response header from upstream 从上游读取响应 header 时在 stderr 中发送的 FastCGI:“主脚本未知” - FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream 从上游读取响应标头时,nginx recv()失败(104:对等连接重置) - nginx recv() failed (104: Connection reset by peer) while reading response header from upstream 连接重置 - 使用 nginx 和 php-fpm7.2 从上游读取响应头时 - Connection reset by peer - while reading response header from upstream using nginx and php-fpm7.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM