Symptoms
-
Website or website preview is unavailable:
502 Bad Gateway
-
In the log files
/var/log/nginx/error.log
or/var/www/vhosts/example.com/logs/proxy_error_log
, the following error messages can be found:[error] 14790#0: *188 upstream sent too big header while reading response header from upstream, client: 203.0.113.2, server: subdomain.example.com, request: "POST /admin_catalog.php HTTP/1.1", upstream: "http://10.0.0.1:7080/admin_catalog.php", host: "subdomain.example.com", referrer: "http://subdomain.example.com/admin_catalog.php"
[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, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/example.com/php-fpm.sock:", host:"example.com", referrer: "https://example.com/wp-admin/post-new.php?wp-post-new-reload=true"
2020/04/27 20:07:05 [error] 4966#0: *39052 proxy_buffer_size x is not enough for cache key, it should be increased to at least xx, client: *****, server: example.com, request: "GET /wp-admin/admin-post.php.."
-
The same symptoms can be observed when WHMCS is installed on the same server as Plesk and when navigating to WHMCS > Clientes > John Doe > Invoices.
Cause
A request cannot be processed by the proxy server because of insufficient buffer size.
Resolution
For one or few domains
-
Go to Domains > example.com > PHP Settings and check the selected PHP handler (the field run PHP as).
-
Go to Domains > example.com > Apache & nginx Settings, scroll down to the field Additional nginx directives and set the following parameters in accordance with the used PHP handler:
-
For PHP handler FPM application served by Nginx and disabled Proxy Mode:
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k; -
For other cases:
proxy_buffers 8 16k;
proxy_buffer_size 32k;
-
Increase values of these parameters if it is needed.
For all domains
-
Connect to the server using SSH.
-
Open the file
/etc/nginx/nginx.conf
for editing. -
Increase the following parameters in the section
http {
:proxy_buffers 8 16k;
proxy_buffer_size 32k;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k; -
Restart nginx to apply changes:
# service nginx restart
Increase values of these parameters if it is needed.