Skip to content

Instantly share code, notes, and snippets.

@webspectyler
Last active May 28, 2019 15:38
Show Gist options
  • Save webspectyler/38691c109792b2fd4302355b829e6580 to your computer and use it in GitHub Desktop.
Save webspectyler/38691c109792b2fd4302355b829e6580 to your computer and use it in GitHub Desktop.
Resolve 504 Gateway timeout in nginx

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:

sudo vim /etc/nginx/nginx.conf Add following in http{..} section

http {
     fastcgi_read_timeout 3000;
     proxy_read_timeout 3000;
}

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 an gateway timeout error immediately.

sudo vim /etc/php/7.3/fpm/pool.d/www.conf

request_terminate_timeout = 3000
sudo service nginx reload
sudo service php7.3-fpm reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment