How to Fix 503 Service Unavailable & 504 Gateway Timeout Errors

A 503 Service Unavailable error means the server is temporarily unable to handle your request, often from overload, maintenance, or a stuck WordPress update. A 504 Gateway Timeout means a proxy waited too long for an upstream server to respond. Back up first, then clear the cause below.

Key takeaways

  • 503 = the server is busy or blocked right now (overload, maintenance mode, a bad plugin, or an attack).
  • 504 = something took too long and a gateway gave up waiting (slow scripts, heavy queries, or low timeout limits).
  • Always back up before you edit files. A stuck WordPress update is fixed by deleting the leftover .maintenance file.
  • Site-side causes (a maintenance file, a plugin) are yours to fix. Server-wide overload or timeouts are usually host-side.
  • If either error keeps returning under normal traffic, your plan is likely under-resourced.

Your site shows a 503 or 504 and won't load

You open your website and instead of your pages you get a short message: 503 Service Unavailable or 504 Gateway Timeout. Sometimes it hits every visitor; sometimes only some pages fail. This is stressful, but the good news is that both errors are almost always temporary and fixable, often in a few minutes.

This guide is for site owners, bloggers, and small businesses, especially on WordPress. You do not need to be a developer. Both of these are server errors (the 5xx family), meaning the problem sits with the server or an app on it, not your browser. For the full family, see our server errors guide.

How to tell what's causing it

Start with three quick checks. They take a minute and point you straight at the cause.

  • Read the error code. A 503 means the server is refusing work right now. A 504 means a wait ran out of time. They have different causes and different fixes.
  • Check if it is every page or just one. A site-wide 503 often means maintenance mode or overload. A 504 on one slow page (like a checkout or a report) usually means a long-running script.
  • Look at timing. Did it start right after you updated WordPress, a plugin, or a theme? Did it start during a traffic spike or a marketing email blast? Recent changes and traffic are your biggest clues.

Also open your host's status page and your hosting dashboard. Many hosts post live incidents there. If your host reports maintenance or an outage, the fix is simply to wait.

Is it your site or your host? If the error started right after an update, or you can trace it to a .maintenance file or one plugin, it is on your side and you can fix it below. If the whole server is slow, many sites on it are down, or your resource limits are maxed out with normal traffic, it is host-side. In that case, contact your host and share the exact error and time.

What's actually happening

503 Service Unavailable

503 Service Unavailable is the server's way of saying "I can't handle this request right now, try again later." The server is running, but it is choosing not to serve the page. Common causes:

  • Server overload or a traffic spike. Too many visitors at once can use up memory or worker processes, so new requests get turned away.
  • Scheduled maintenance. Some servers and apps return a 503 on purpose while updates run.
  • Hitting resource limits. Shared plans cap memory, CPU, and simultaneous processes. Reaching a cap can trigger a 503.
  • A stuck WordPress maintenance mode. WordPress creates a hidden .maintenance file during updates and deletes it when done. If an update is interrupted, that file gets left behind and shows "Briefly unavailable for scheduled maintenance," which is a 503.
  • A misbehaving plugin that crashes or loops and exhausts resources.
  • A DDoS attack that floods the server with fake traffic until it stops responding.

504 Gateway Timeout

504 Gateway Timeout means one server, acting as a gateway (a middle-man such as a proxy, load balancer, or CDN), asked another server (the upstream) for a response and did not get one in time, so it gave up. The request was not refused; it simply ran out of time. Common causes:

  • An overloaded server that is too busy to answer within the time limit.
  • Slow or long-running scripts such as imports, backups, or big reports.
  • Heavy database queries that take many seconds to finish.
  • PHP timeouts. If a PHP script runs longer than max_execution_time, it is stopped, which can surface as a 504.
  • CDN or proxy timeouts set to a short limit that expires before your server replies.
  • Low server timeout limits on the web server itself.

A close cousin of the 504 is the 502 Bad Gateway, where the gateway gets a broken reply instead of no reply. If you see 502s too, that guide is your next stop.

Your options at a glance

Match the error to its likely fix, then follow the matching step-by-step list below.

ErrorMost likely causeFirst thing to try
503 Service UnavailableStuck WordPress update or a bad pluginDelete the .maintenance file, then deactivate plugins
503 Service UnavailableTraffic spike, attack, or resource limitsCheck analytics and logs; ask your host about overload
504 Gateway TimeoutSlow script or PHP timeoutRaise max_execution_time; optimize the slow task
504 Gateway TimeoutCDN or proxy timeoutCheck CDN/proxy timeout settings; retry

How to fix it, step by step

Fix a 503 Service Unavailable error

  1. Back up your site first. Before touching files, make a full backup so you can undo any mistake. Follow our website backups guide if you are not sure how.
  2. Check for a stuck maintenance mode. If the page says the site is "briefly unavailable for scheduled maintenance," an update was interrupted. Open your host's File Manager or connect by FTP, go to the WordPress root folder (the one with wp-config.php), and delete the hidden .maintenance file. Reload the site.
  3. Deactivate plugins and switch to a default theme. If the error stays, a plugin or theme may be crashing. Rename the wp-content/plugins folder to plugins-off to disable all plugins at once, then reload. If that fixes it, restore the folder name and re-enable plugins one by one to find the bad one. Switch to a default theme such as twentytwentyfour to rule out the theme.
  4. Check for a traffic spike or attack. Open your analytics and your host's access logs. A sudden flood of requests from odd locations can point to a spike or a DDoS attack. If you find one, enable your CDN's attack protection or ask your host to help block it.
  5. Increase server resources or ask your host. If nothing on your side is wrong, you may be hitting your plan's memory or process limits, or the server may be under maintenance. Check your resource usage in the dashboard, and contact your host to confirm whether the server is overloaded or being worked on.

Fix a 504 Gateway Timeout error

  1. Refresh and retry. A 504 is often a one-off from a brief slow moment. Wait about a minute, then reload the page. If it clears, keep an eye on it but no fix is needed.
  2. Increase PHP timeouts. If a specific task times out, raise the PHP time limit. The main setting is max_execution_time (in seconds); a value like 300 gives long tasks more room. See our PHP settings guide for where to change it safely. Note: on Nginx servers the real wait limit is the upstream or proxy timeout, which is set on the host side, so you may need your host to raise it.
  3. Check your CDN or proxy timeout settings. If you use a CDN or proxy (such as Cloudflare), it has its own timeout. If your server is slow to reply, the CDN can return a 504 before your server finishes. Review the CDN's timeout options or temporarily pause it to test.
  4. Optimize slow queries and disable heavy plugins. Long database queries and bloated plugins are common timeout causes. Disable heavy plugins one at a time, clean up your database, and split large jobs (like imports) into smaller batches.
  5. If it persists under normal traffic, talk to your host. When timeouts keep happening even with steady, normal visits, the plan is likely under-resourced for your site. Contact your host to review CPU, memory, and server timeout limits, or to discuss a larger plan.

Common mistakes to avoid

Delete the right file. The only file you should remove for a stuck 503 is the hidden .maintenance file in the WordPress root. Do not delete wp-config.php, .htaccess, or the wp-content folder. Removing the wrong file can take the whole site down, so back up before you start.

A few other traps catch people out:

  • Ignoring a real traffic spike. If the 503 started when your visits jumped, the cause is load, not a broken file. Chasing plugins will waste time. Look at your analytics first.
  • Not checking the host status page. If your host is doing maintenance or has an outage, no amount of editing will help. Check their status page before you change anything.
  • Raising timeouts forever. Bumping max_execution_time hides a slow script; it does not fix it. Use it to buy time, then optimize the real cause.

How to prevent it in future

A few habits keep 503 and 504 errors from coming back:

  • Use a staging site and safe updates. Test plugin, theme, and core updates on a copy first so an interrupted update never breaks your live site. Keep a fresh backup before every update.
  • Add caching and a CDN. Page caching and a CDN absorb traffic spikes so your server does far less work, which prevents overload 503s.
  • Keep adequate resources. If your traffic has grown, make sure your plan's memory and CPU match it. Steady, avoidable errors are a sign you have outgrown the plan.
  • Optimize the database. Clean out old revisions, spam, and transients, and add indexes for slow queries. A lean database answers faster and rarely times out.

Frequently asked questions

What's the difference between a 503 and a 504 error?

A 503 Service Unavailable means the server is up but temporarily refusing requests, usually from overload, maintenance, or a stuck update. A 504 Gateway Timeout means a gateway (like a proxy or CDN) waited for another server and got no reply in time. In short, 503 is "too busy" and 504 is "too slow."

Why did my site get stuck in maintenance mode?

WordPress creates a hidden .maintenance file while it updates and deletes it when finished. If the update is interrupted, by a timeout, a closed tab, or a failed plugin, that file is left behind and the site keeps showing a 503. Deleting the .maintenance file in the WordPress root folder clears it.

Is a 503 or 504 error my fault?

Not always. Site-side causes, like a stuck maintenance file, a broken plugin, or a slow script, are yours to fix. But server-wide overload, low server timeout limits, and provider maintenance are host-side. Use the "Is it your site or your host?" checks above to tell which one you have.

How do I stop repeated timeouts?

Find and fix the slow task rather than only raising limits. Optimize heavy database queries, split large jobs into batches, disable bloated plugins, and add caching. If timeouts keep happening under normal traffic, your plan is likely under-resourced, so review it with your host.

Will a 503 or 504 hurt my Google rankings?

A short, rare 503 or 504 is unlikely to hurt rankings; search engines expect occasional downtime. A true 503 even tells crawlers to come back later. The risk comes from long or frequent outages, so fix the cause quickly and watch for repeats.

Does clearing my browser cache fix these errors?

Rarely, because 503 and 504 are server-side. It is still worth a quick reload and a check in a private window to rule out a stale cached error page. If the error stays, the fix is on the server, using the steps above.

Summary

A 503 means the server is too busy or blocked; a 504 means something took too long and a gateway gave up. Back up first, then work the matching list: for a 503, clear a stuck .maintenance file and rule out plugins and load; for a 504, raise max_execution_time, check your CDN, and optimize slow tasks. If either keeps returning under normal traffic, it is host-side. For a wider view of every 5xx code and how they connect, head back to our server errors guide.

References

  • MDN Web Docs — HTTP response status codes 503 Service Unavailable and 504 Gateway Timeout.
  • WordPress Support — "Briefly unavailable for scheduled maintenance" and the .maintenance file.
  • PHP Manual — max_execution_time configuration directive.
Bitrich777 Hosting Team
About the author

The editorial team behind the Bitrich777 Hosting Help Center — practical, tested guides on web hosting, WordPress, servers, DNS, SSL, email, security and migration. Every walkthrough is reproduced on a live host before it is published.

Spotted an error? Tell us