Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

successdav's avatar

Frequent 504 Gateway Time-out

My site is hosted on Digital Ocean: Ubuntu 20.04 x 64 1GB Memory 25GB Disk. I experience this error like 3-4 times daily and then after a while, the site is back again.

When this happens, restarting the server does not help I will have to wait for a period of time before the site begins to load again.

Could this be a server misconfiguration or do I have to upgrade the server? or maybe something else.

0 likes
3 replies
bestmomo's avatar
bestmomo
Best Answer
Level 52

There are two main reasons for this error :

  • proxy : if the project is developing rapidly in a relatively short time and the number of visitors is increasing rapidly, but the proxy no longer has the necessary resources to process all HTTP requests. It is also possible that bad configurations could be the cause of the failure to process customer requests
  • application : too long and exceeded HTTP processing time can also be caused by a faulty database systems or other applications that are not functioning normally.
successdav's avatar

using sudo free -m here the report I get for the memory usage

              total        used        free      shared  buff/cache   available
Mem:            981         686          69          70         224          74
Swap:             0           0           0

I have 69 free out of 981, I suppose that's on the low end, is it?

Tray2's avatar

Sounds like you are pulling a bit more data from the database than you need and process it serverside which is quite bad. I suggest you install debugbar and take a look at all your pages.

1 like

Please or to participate in this conversation.