django - Nginx timeout settings
巴扎黑
巴扎黑 2017-05-16 17:29:42
0
4
546

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?

巴扎黑
巴扎黑

reply all(4)
黄舟

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.

PHPzhong

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...

漂亮男人

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

淡淡烟草味

Check if it is 504 or 502

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!