Email VPS
Troubleshooting and repair

What the gateway errors 502, 503 and 504 mean

The server does not answer in time

The three errors look almost the same in the browser but mean different things. The number tells you whose turn it was to fail, and that saves a lot of guessing.

In short

  • 502 means a server in the middle received an invalid answer from the back end.
  • 503 means the service is temporarily unavailable, often because of load or maintenance mode.
  • 504 means the answer took too long, so something is slow rather than broken.

What separates the numbers

ErrorWhat the server is sayingMost common cause
502 Bad GatewayI got an answer but I cannot make sense of itA PHP process died mid response
503 Service UnavailableI am not taking requests right nowA load spike, a resource limit or maintenance mode
504 Gateway TimeoutI waited for an answer and did not get one in timeA heavy query, an external API or a scheduled task

1. Wait a moment and reload

All three are often temporary. If the site recovers on its own within a minute, it was a momentary spike. An error that keeps coming back is a different matter and needs to be traced, because your customers meet it too.

2. Is the fault in the site or in the server

Log in to your hosting panel. If the panel works but the site does not, the server is up and the fault is in the site. If nothing opens, this is a wider outage. The same triage is covered in more detail in our guide on a website that will not load.

3. Look at resources and the error log

503 and 502 often come from a site trying to use more memory or more concurrent processes than the plan allows. The error log shows which request died and when. If the same plugin keeps appearing, you have found the cause.

4. Find the slow part if the error is 504

504 almost always means something takes too long. Typical causes are a heavy database query, an import or export, an external API that does not answer, and a scheduled task that runs on every page load. If the site is sluggish in general, start from our guide on why a WordPress site is slow.

5. Rule out a traffic spike

A bot or a crawler can read the site fast enough to congest the server. Your visitor statistics show whether the traffic is human or machine. In that case the right fix is to limit the request rate, not to buy a bigger plan.

What not to do

Do not hit reload over and over. Every load adds pressure, and 503 gets worse from exactly that. Do not remove plugins by guessing either, before the log has been read, because removing the wrong one takes features away and fixes nothing.

If you would rather not do it yourself

We read the error log, find the part that crashes or stalls and fix it. We also tell you what caused it, so the same thing does not repeat next month.

See how we repair a broken site »