I am getting a weird problem with my NGINX server. The website opens up and is functional while browsing off Incognito, but for any new browser/session, I am getting the NGINX 502 Bad Gateway error. I only have the following in the error log.
[error] 2121#2121: *34 upstream sent too big header while reading response header from upstream, client: xx.xx.xx.xx, server:domain.tld, request: "GET / HTTP/2.0", upstream:"fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "domain.tld"
The config file is attached
server {
server_name domain.tld www.domain.tld;
root /var/www/html/domain.tld/public_html;
index index.html index.php;
http2_push_preload on;
location / {
try_files $uri $uri/ /index.php?$args;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html/domain.tld/public_html$fastcgi_script_name;
}
location = /xmlrpc.php {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location ~ /\.ht {
deny all;
}
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
# managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.domain.tld) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = domain.tld) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name domain.tld www.domain.tld;
listen 80;
return 404; # managed by Certbot
}