Stack Exchange Network
Stack Exchange network consists of 182 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Yet if I debug my application, the response may be delayed for an infinite amount of time, yet after 30 seconds I get:
504 Gateway Time-out
as a response.
How can I disable the timeout and have my reverse proxy wait forever for a response? And I like the setting to be global, so that I do not have to set it for each proxy.
It may not be possible to disable it at all, yet a feasible workaround is to increase the execution time. On a
nginx tutorial site
, it was written:
If you want to increase time-limit for all-sites on your server, you
can edit main
nginx.conf
file:
vim /etc/nginx/nginx.conf
Add following in http{..} section
http {
fastcgi_read_timeout 300;
proxy_read_timeout 300;
and reload nginx' config:
sudo service nginx reload
I have used a rather large value that is unlikely to happen, i.e. 999999
or using time units, to one day via 1d
.
Beware that setting the value to 0
will cause a gateway timeout error immediately.
–
–
–
–
–
It is possible to increase the timeout for nginx, to add to @k0pernikus 's answer, the following can be added to your location block:
location /xyz {
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
proxy_send_timeout 1800;
send_timeout 1800;
Here 1800 is in seconds.
After changing the config, verify the syntax with:
nginx -t -c /some/path/nginx.conf
Then reload nginx with:
nginx -s reload
–
–
–
–
–
–
I've been fighting with nginx 502 timeout error and could not solve the issue. However, it happened to be gunicorn causing the timeout error. So you might also need to check your fastcgi settings.
For gunicorn it's:
gunicorn wsgi:application --timeout 300