Note: This article was originally published in 2013. Some steps, commands, or software versions may have changed. Check the current NginX documentation for the latest information.
If you’re encountering this issue, this troubleshooting guide will help you identify the root cause and apply the appropriate fix. This applies to NginX environments.
Resolve: Upstream sent too big header while reading response header from upstream when using (http://nginx.org/ “Nginx”) (http://www.php.net “PHP”) FPM
When working with NginX you will be using an upstream (http://php-fpm.org/ “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 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”.
(http://img.zemanta.com/zemified_h.png?x-id=9c4e0138-4e0e-4d3b-b8ab-d34f749209bb)](http://www.zemanta.com/?px “Enhanced by Zemanta”)
Summary
This guide covered the common causes and solutions for this NginX issue. If the problem persists, check the official documentation or system logs for additional diagnostic information.