search

Home  >  Q&A  >  body text

django - Nginx timeout settings

I use Nginx Django FastCGI to run a service to process a huge XML. The file is too large and the processing is slow. It times out halfway through the process.
I changed the Nginx configuration. It was originally 60 and changed to 120, but it seems to have no effect. It still times out in 60 seconds.

location ^~ /api/ {
    proxy_read_timeout 120;
    proxy_connect_timeout 120;
    fastcgi_pass 127.0.0.1:8080;
}

Is there anything else that needs to be changed?

巴扎黑巴扎黑2752 days ago604

reply all(4)I'll reply

  • 黄舟

    黄舟2017-05-16 17:31:42

    should use:

    fastcgi_read_timeout 600;
    fastcgi_send_timeout 600;

    These two options.
    fastcgi_read_timeout refers to the timeout of the entire process of sending a response from the fastcgi process to the nginx process
    fastcgi_send_timeout refers to the timeout of the entire process of the nginx process sending a request to the fastcgi process

    Both options default to seconds (s) and can be manually specified as minutes (m), hours (h), etc.

    reply
    0
  • PHPz

    PHPz2017-05-16 17:31:42

    For pages that take a long time to process events, it is best to change to asynchronous processing. The connection time of Nginx does not seem to exceed 75 seconds.

    fastcgi_connect_timeout 75;
    fastcgi_read_timeout 120;
    fastcgi_send_timeout 120;

    http://wiki.nginx.org/HttpFastcgiModu...

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 17:31:42

    proxy is the time for the proxy to communicate with the backend, and the fastcgi timeout needs to be modified

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:31:42

    Check if it is 504 or 502

    reply
    0
  • Cancelreply