Question: Plesk site unavailable: 502 Bad Gateway: upstream sent too big header while reading response header
Applicable to:
Symptoms- A website or its preview is unavailable in Plesk
502 Bad Gateway
- The following entries are logged to the domain/system logs: /var/log/nginx/error.log, /var/www/vhosts/example.com/logs/proxy_error_log
[error] 14790#0: *188 upstream sent too big header while reading response header from upstream, client: 203.0.113.2, server: example.com[error] 707#0: *2016153 FastCGI sent in stderr: "PHP message: Error checking in buffer: The buffer you checked in was not checked out" while reading upstream, client: 203.0.113.2, server: example.com
[error] 4966#0: *39052 proxy_buffer_size x is not enough for cache key, it should be increased to at least xx, client: 203.0.113.2, server: example.com- The same happens on WHMCS with Plesk when navigating to Clients > John Doe > Invoices
CauseThe proxy server can't process the request because the configured buffer size is too small.
ResolutionIncrease the buffer size for either the affected domains or all domains on the server.
Note: If the example values below are not enough, increase them
Individual Domains
1.Log in to Plesk
2.Go to Domains > example.com > Apache & nginx
3.Scroll down to Additional nginx directives and enter these settings:
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
proxy_buffers 8 16k;
proxy_buffer_size 32k;4.Press OK
All Domains 1.Log in over SSH
2.Edit /etc/nginx/nginx.conf
# vi /etc/nginx/nginx.conf
3.Increase these parameters in the section http {
proxy_buffers 8 16k;
proxy_buffer_size 32k;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;4.Restart nginx to apply the changes
# service nginx restart