[英]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提前致谢
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.