Plesk

Websites hosted on Plesk server are unavailable with 502 Bad Gateway: upstream sent too big header while reading response header

Symptoms

Cause

A request cannot be processed by the proxy server because of insufficient buffer size.

Resolution

For one or few domains

  1. Log into Plesk.

  2. Go to Domains > example.com > PHP Settings and check the selected PHP handler (the field run PHP as).

  3. 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

  1. Connect to the server using SSH.

  2. Open the file /etc/nginx/nginx.conf for editing.

  3. Increase the following 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 changes:

    # service nginx restart

Increase values of these parameters if it is needed.

Exit mobile version