How to increase nginx timeout for upstream uWSGI server?
<p>Stack used:</p>

<p>Nginx -> Uwsgi (proxy passed) -> Django</p>

<p>I have an API that takes aroundn 80 seconds to execute a query. Nginx closes the connection with the upstream server after 60 seconds. This was found in the nginx error log:</p>

<pre><code>upstream prematurely closed connection while reading response header from upstream
</code></pre>

<p>The uWSGI and django application logs do not show anything weird.</p>

<p>This is my nginx configuration:</p>

<pre><code>server {
   listen 80;
   server_name xxxx;
   client_max_body_size 10M;

   location / {
       include         uwsgi_params;
    proxy_pass http://127.0.0.1:8000;
    proxy_connect_timeout 10m;
    proxy_send_timeout   10m;
     proxy_read_timeout   10m;
     proxy_buffer_size    64k;
     proxy_buffers     16 32k;
     proxy_busy_buffers_size 64k;
     proxy_temp_file_write_size 64k;
     proxy_pass_header Set-Cookie;
     proxy_redirect     off;
     proxy_hide_header  Vary;
    proxy_set_header   Accept-Encoding '';
     proxy_ignore_headers Cache-Control Expires;
     proxy_set_header   Referer $http_referer;
     proxy_set_header   Host   $host;
     proxy_set_header   Cookie $http_cookie;
     proxy_set_header   X-Real-IP  $remote_addr;
     proxy_set_header X-Forwarded-Host $host;
     proxy_set_header X-Forwarded-Server $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}
</code></pre>

<p>How do I increase the timeout, I have tried settings the proxy_pass timeout variables but they do no seem to be working.</p>