Applicable to:
- Plesk for Linux
Symptoms
-
Website or website preview is unavailable:
PLESK_INFO: 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:CONFIG_TEXT: [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"
CONFIG_TEXT: [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"
CONFIG_TEXT: 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
-
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:
CONFIG_TEXT: fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k; -
For other cases:
CONFIG_TEXT: 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 {
:CONFIG_TEXT: 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.
Comments
10 comments
nice 2 know :-)
Doesn't work. How do you calculate the buffer size?
Hello @Sharul,
For determining the size which will be suitable for you, please, refer to these links:
https://gist.github.com/magnetikonline/11312172#determine-fastcgi-response-sizes
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffer_size
Not working for me
Hello Khoneketa,
Error 502 for websites may have a variety of causes, e.g. issues with PHP or Apache down.
Try checking this article for guidance: https://support.plesk.com/hc/en-us/articles/115001463089--HUB-502-Bad-Gateway
In case this wouldn't help, consider submitting a request for Plesk Support:
https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-
Works for me as well :)
Thanks very much !! Work fine ;-)
Hello,
In my logs I only have this:
upstream sent unexpected FastCGI record: 3 while reading response header from upstream
All websites on the server are unreachable and give Error 502
I contacted support and got just this as a solution. I applied it. But the situation repeats.
Hello @Kea,
This issue was addressed in ticket already. If you are working with support directly, feel free to re-open the ticket as issue may have different symptoms and have another cause.
Nothing ... I've really tried them all but I always get a 502 error. I visualize the site (Magento 2) with "website preview".
In the log file "/var/log/sw-cp-server/error_log" I read the error: "upstream sent too big header while reading response header from upstream, client: 127.0.0.1".
I have modified both from "Apache & nginx Settings> Additional nginx directives" and directly from "/etc/nginx/nginx.conf" but nothing.
What else can I do? Anyone have other indications?
Please sign in to leave a comment.