Reputation: 159
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. Both have a login setup but one is giving me a 502 error anytime i attempt to login. Anytime i attempt to login i get a 502 error and if i check the nginx error log i see the following:
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/"
My conf file for the site is as follows, which is excactly the same as my other site which runs perfectly fine:
#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. Has nayone run into anything similar and have anything else i should try?
Thanks in advance
Upvotes: 1
Views: 2633
Reputation: 159
Found the issue!
Had to add the following the nginx.conf file
http {
...
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 90;
fastcgi_send_timeout 90;
fastcgi_read_timeout 90;
}
Upvotes: 5