Resolve: Upstream sent too big header while reading response header from upstream when using NginX PHP FPM

Resolve: Upstream sent too big header while reading response header from upstream when using NginX PHP FPM

When working with NginX you will be using an upstream PHP FPM server. Because of the way NginX works it will treat this upstream server as a proxy server which you will use to server PHP requests. One of the settings you can control is the buffer size used for the headers. You want to size your buffer size correctly otherwise you might get a lot of errors like this one:

2013/12/21 22:58:04 [error] 46171#0: *1670 upstream sent too big header while reading response header from upstream, client: 123.123.123.123, server: cloudingenium.com, request: “GET /wp-admin/admin.php?page=jetpack&action=authorize […] upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host: “www.CloudIngenium.com”

Simply add the following lines if you are missing them and adjust the sizes as you see fit:

2
3
4
5
http {
….
fastcgi_buffers 16 32k;
fastcgi_buffer_size 32k;

or adjust the proxy buffer if you are using a proxy/cache:

proxy_buffer_size 64k;

proxy_buffers 4 128k;

proxy_busy_buffers_size 128k;

Don´t forget “proxy_temp_file_write_size” must be equal to or greater than the maximum of the value of “proxy_buffer_size” and one of the “proxy_buffers”.

Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.