I'm currently trying to switch from an Apache server to using nginx to be load resistant.
But I came across an error that I can not solve and I would be happy for your help, so: Most pages (php) work smoothly, Unexpectedly certain pages when I browse to them I get a 502 error Quote the error from the error.log logs
2022/01/25 18:51:57 [error] 848#848: *4 upstream sent too big header while reading response header from upstream, client: 147.234.64.35, server: XXXX.com, request: "GET /XXX.php?XXX=true&XXX=no&XXX= HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "XXX.com"
But what I do not understand most is that when I enable error output by adding the value "ini_set ('display_errors', 1);" At the top of the code, it works smoothly without a 502 error
This is defined for me in the file / etc / nginx / sites-available / default
server {
server_name domain.com;
root /var/www/html;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/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 = domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name domain.com;
return 404; # managed by Certbot
}
I would appreciate any assistance or preparation Thanks