Solutions to nginx upstream timed out (Two Situations)

This can happen in either of the following two scenarios.

1. nginx proxy

The proxy_read_timeout value needs to be adjusted appropriately.

location/{

proxy_read_timeout 300;


location/{ …}

 

2. nginx as other upstream services such as php-fpm

In this case, adjust the fastcgi_read_timeout option value appropriately.

location ~ .+\.php($|/) {

fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_read_timeout 300;

}

 

The relevant configurations for the server section are.

large_client_header_buffers 4 16k;
client_max_body_size 30m;
client_body_buffer_size 128k;
#proxy_connect_timeout 300;
#proxy_read_timeout 300;
#proxy_send_timeout 300;
#proxy_buffer_size 64k;
#proxy_buffers 4 32k;
#proxy_busy_buffers_size 64k;
#proxy_temp_file_write_size 64k;

fastcgi_connect_timeout 75;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 64k;
fastcgi_temp_file_write_size 64k;

Choose the above configuration depending on the proxy or fastcgi used by your server.

Similar Posts: