Search code examples
phplaravelapachedockerhttp-status-code-504

504 gateway time-out after 3 minutes (Apache in Docker)


I work on a Laravel project hosted in a Docker container with Apache. I have a script which call an API, it can take more than 3 minutes to respond, but I get this timeout error every time after 3 minutes:

504 gateway time-out

I tried to increase Apache Timeout to 600 (default 300) in default.conf file, and php timeout like max_execution_time and max_input_time each to 600.

Anyone would know where could this 3 minutes timeout come from ?

Thanks


Solution

  • PHP + Laravel is sometimes a bit tricky.

    • First check the cases that take less than 1 minute several times (for blocked request scenario).
    • Then check "local"/"docker build" php config (for default timeout).
    • Check Laravel's default timeout (sometimes the frameworks timeout is less than Apache's).
    • Check what Yuriky suggests if you have proxies.

    I don't know if this is your case, but if your file is very big, at some point PHP might be running out of memory, so if you still have the problem, also check PHP's memory limits.

    I hope that helps!