[Solved] FastCGI, Drupal, Nginx, PHP7.2-FPM Error upstream sent too big header while reading response header from upstream


When you try to load Drupal Web app on Nginx and Nginx Web server through an error: Upstream sent too big header while reading response header from upstream, client: IP-Address, server: ServerName, Request

 
Problem:
 
The problem is that Nginx is not configured to wait for FastCGI a PHP processor to respond, chances are that Nginx has a time-out limit defined in its config file. 
 
Solution:
 
Just add these lines of code inside the http block in nginx.conf file : client_max_body_size 500M; fastcgi_buffer 8 16k; fastcgi_buffer_size 32k; 

- Nginx times-out because of the data being processed by the php-fpm server is too big. One way to solve this is by adjusting the php.ini file by increasing max-execution-time from 30 to 60 (this time is in seconds).
- After making a change to php.ini restart the php-fpm by using this command: systemctl restart php7.2-fpm (this depends on what version of php fpm you are using)
 
- Likewise, you would want to make changes to the http block in Nginx config file like so:

      http {
fastcgi_buffer 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
 
            }
- Reload Nginx and PHP7.2-fpm
 
- If the above does not work, edit (etc/php-fpm.d/www.conf) and change request_terminate_timeout = 300, after this reload php and Inginx


[NB] If you find yourself dealing with this problem, then the issue is bigger than just increasing time-outs but work on optimizing the performance of your application by decreasing the database queries or increasing the application start up time.

Servers
published
v.0.01




© 2024 - ErnesTech - Privacy
E-Commerce Return Policy