Sometimes my website just goes down and I get a 504 Gateway Timeout error. What is happening?
The 504 Gateway Timeout error means that one server didn't receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser. Or more precisely, a different computer besides the web server, isn't able to communicate with another server it needs to.
This could happen if a specific application or plugin needs to access something on another server and that server is overloaded or down. Then you would get a 504 Gateway Timeout error.
RFC-7231 defines a 504 status code as:
The 504 (Gateway Timeout) status code indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.
The other server does not need to be an external server. It can also be a another service or server-like entity within the main web server such as a reverse proxy, mail server, database server etc...
These errors are usually temporary and will eventually go away. The exact cause is sometimes hard to determine but a qualified system administrator should be able to check which site or service is unable to connect to the other server or service. Some of the things that can be checked are:
- Restart the services (or reboot your server)
- Check your proxy settings (if using a CDN such as CloudFlare for example)
- Check for DNS issues
- Disable the sites CDN temporarily to rule it out as a possible problem
This is usually not caused by Apache or the cPanel & WHM software.