Answer the question
In order to leave comments, you need to log in
How to avoid 504 Gateway Timeout error?
Hello everyone, I asked myself this question, I started writing a bot in php, I need the script to run for a short period of time when the script is launched in the browser, let's say it's 5-10 minutes, but it will give a 504 Gateway Time-out error in 30 seconds
. I need code optimization, I need to avoid the 504 error
. Maybe I'm not writing the bot correctly?
Is it possible to make the script run as long as it needs?
Answer the question
In order to leave comments, you need to log in
Judging by the 504 Gateway Time-out, you have nginx in front of PHP. If this is the case, add a setting to the site configuration to wait for the upstream response time. If you use FastCGI then:
if proxying is used, then:
In general, such scripts are launched not through a web server, but from the console, settingset_time_limit(0);
The simplest thing is to increase the timeout on the server to what is needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question