Applicable to:
Plesk for Linux
Symptoms
Websites are 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 message 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"
Also, the following error message can be found in the log file
/var/www/vhosts/example.com/logs/proxy_error_log
:[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"
Cause
A request cannot be processed by the proxy server because of insufficient buffer size.
Resolution
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:
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;For other PHP handlers:
proxy_buffers 8 16k;
proxy_buffer_size 32k;
Increase values of these parameters if it is needed.
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; 改成 8 128k
proxy_buffer_size 32k; 改成 256K
fastcgi_buffers 8 16k; 改成 8 128k
fastcgi_buffer_size 32k; 改成 256KRestart nginx to apply changes:
# service nginx restart
# service httpd restart
Increase values of these parameters if it is needed.