2

How can I disable the nginx timeout when accessing through a specific port, or simply a specified folder. Whichever is easier.

Basically I have some scripts which need to execute for a long period of time and the gateway timeout is preventing them from completing.

Belgin Fish
  • 919
  • 5
  • 17
  • 31

2 Answers2

2

Normally if you have scripts that need more time there are a few solution.

  1. You can increase the fastcgi_read_timeout and reqest_terminate_timeout. But the problem is you shouldn't set the value too high. If you have a lot of processes that blocks each other they are open for a long time and its possible that your server can't deliver your content anymore.

  2. What i prefer is don't execute long running scripts over your Webserver. Use the command line and run your script with a cron for example. Normally a Webserver is not a very good way to execute long running scripts.

I had the same problem before a few month we have changed to php-cgi and had a script which was running over wget. I have changed the script that it was running with a CLI.

René Höhle
  • 1,438
  • 3
  • 17
  • 26
1

There are two directives involved here, one at nginx fastcgi_read_timeout as described here, the other is at php-fpm.conf reqest_terminate_timeout, you can set this to 0 to disable timeout.

At nginx set fastcgi_read_timeout to any arbitrary large value as answered in my first link, you can set this inside any specific location.

fudanchii
  • 126
  • 2