Skip to content

WordPress 503 Service Unavailable: find the layer, then fix it

Learn how to find and fix a WordPress 503 Service Unavailable error. This guide shows you how to read the response to tell which layer sent it (a leftover .maintenance file, the PHP-FPM service that runs PHP, Apache, Nginx, or a CDN in front of your site), then apply the fix that belongs to that layer.

This guide helps WordPress site owners and admins find and fix a 503 Service Unavailable error. A 503 means a program between the visitor and WordPress refused the request, and five different layers can send one. The most common cause is a leftover .maintenance file in the site root after an interrupted update, and deleting it fixes the site in seconds. It can also come from PHP-FPM (the service that runs WordPress’s PHP code), from Apache or Nginx failing to reach it, or from a CDN (content delivery network) like Cloudflare. So start with one curl command that reads the response headers and body, because they tell you which layer answered and which fix to apply.

What you’ll accomplish

  • Identify, from the response alone, which tier emitted the 503: CDN or WAF, web server, PHP-FPM, or WordPress itself.
  • Clear the most common cause, a stale .maintenance file, and finish the update that left it behind.
  • Read the PHP-FPM and web-server logs well enough to separate a saturated pool from a missing socket.
  • Confirm the site is genuinely serving 200 again, from outside the cache and from the origin directly.
  • Put in place the small number of changes that keep the same 503 from recurring after the next update or traffic spike.

Prerequisites

  • WordPress 5.6 or newer. The maintenance behaviour described here has been stable across the 5.x and 6.x lines.
  • Shell access over SSH, or a file manager that can see dotfiles. cPanel’s File Manager hides them until you enable Show Hidden Files in its settings dialog.
  • Permission to read the web-server and PHP-FPM logs. On shared cPanel hosting you will usually have your own domain log but not the system PHP-FPM log; the workarounds are in Troubleshooting.
  • WP-CLI is optional but shortens several steps. Where a WP-CLI command appears, the manual equivalent is given alongside it.
  • Paths in this guide use Debian and Ubuntu conventions (/var/log/nginx/, /run/php/). On CentOS, AlmaLinux, and cPanel servers the same files live under /var/log/httpd/, /opt/cpanel/, and /var/log/php-fpm/. Substitute your PHP version wherever 8.2 appears.

How it works

A request to a WordPress page passes through several independent programs, and every one of them is capable of returning 503 on its own authority. Reading the response tells you where it stopped.

Five tiers a WordPress request crosses — CDN or WAF, Nginx, Apache with mod_proxy_fcgi, the PHP-FPM pool, and WordPress core — each with the log line and response body that identifies it as the source of a 503

WordPress core is the friendliest of the five, because it announces itself. During any core, plugin, or theme update, WordPress writes a file named .maintenance into the site root containing a single PHP timestamp. On every subsequent request, wp-includes/load.php reads that timestamp before loading anything else and, if it is recent, sends the familiar “Briefly unavailable for scheduled maintenance. Check back in a minute.” page with a 503 status and a Retry-After: 600 header. Core is meant to delete the file when the update finishes. An update that dies partway through, or a browser tab closed mid-upgrade, leaves it behind.

There is a detail worth knowing: core ignores a .maintenance file whose timestamp is more than ten minutes old. So if a site is still serving the maintenance page half an hour later, the plain stale-file story is incomplete. Either something is rewriting the file, or the maintenance page is coming from a plugin with its own toggle rather than from core.

PHP-FPM produces 503s two ways. When every child process in the pool is busy, new requests queue in the listen backlog; once that fills, the web server sees the connection refused and turns it into an error page. And after a PHP version switch, the socket path in the web-server config may point at a file that the new pool never created, so the connection fails on the very first attempt.

Apache and Nginx disagree about what to call that failure, which is the single most useful fact on this page. Apache’s mod_proxy_fcgi reports a backend it cannot reach as 503. Nginx reports the same condition, a fastcgi_pass to a dead socket, as 502, and reserves 503 for a named upstream block whose members are all marked down, for limit_req and limit_conn rejections, and for an explicit return 503. If you are on Nginx and seeing 503 rather than 502, look at rate limiting and upstream health before you look at the socket.

A CDN or WAF in front can answer without your server ever hearing about it. Cloudflare’s own error pages carry a CF-Ray header and a Cloudflare-branded body, and the giveaway is that nothing corresponding appears in your access log at that timestamp.

That ordering gives a decision path. Work down it, and stop at the first match.

Decision tree for a WordPress 503 — check for Cloudflare headers, then the maintenance body text, then the PHP-FPM max_children warning, then Apache and Nginx upstream errors, falling through to account resource limits

Step-by-step

  1. Read the headers before you change anything. This one command decides everything that follows.

    curl -sSI https://example.com/ | sed -n '1,25p'

    You are looking for three things: the status line itself, a CF-Ray or Server: cloudflare header, and Retry-After. A response of HTTP/2 503 with retry-after: 600 and no Cloudflare headers is WordPress core talking. A cf-ray header means the edge answered.

  2. Read the body, which names the source in plain English.

    curl -s https://example.com/ | head -c 600

    The string Briefly unavailable for scheduled maintenance confirms core. A Cloudflare-branded page confirms the edge. A bare 503 Service Temporarily Unavailable with nginx or Apache as the only other text means the web server generated it and PHP was never involved.

  3. If the edge answered, test the origin directly. Resolve the hostname to your server’s own address so the request bypasses Cloudflare entirely.

    curl -sSI --resolve example.com:443:203.0.113.10 https://example.com/

    If that returns HTTP/2 200, your server is healthy and the problem is a rate-limiting or WAF rule at the edge. Fix it in the Cloudflare dashboard under Security, not on the server.

  4. If core answered, look for the file. From the site root:

    ls -la .maintenance

    Expected output on a stuck site is a line like -rw-r--r-- 1 www-data www-data 40 Aug 31 03:12 .maintenance. Note the timestamp: if it keeps advancing between runs of this command, an update loop is still writing it and you should let it finish rather than delete it.

  5. Delete it, then finish the update that abandoned it.

    wp maintenance-mode status
    wp maintenance-mode deactivate

    WP-CLI prints Maintenance mode is active. then Success: Deactivated maintenance mode. Without WP-CLI, rm .maintenance does the same thing. Either way the site is now serving requests with a half-applied update, so immediately run wp core update, wp plugin update --all, and wp core update-db to bring the install back to a consistent state. Deleting the file alone is not the end of the job.

  6. If neither core nor the edge answered, go to the PHP-FPM log.

    sudo grep -i 'max_children' /var/log/php8.2-fpm.log | tail -5

    A line reading WARNING: [pool www] server reached pm.max_children setting (10), consider raising it is definitive: the pool ran out of workers. Sizing the replacement value is its own exercise, covered in calculating pm.max_children for PHP-FPM. Raising the number blindly on a memory-constrained box trades a 503 for an out-of-memory kill.

  7. Check that the pool is running and its socket exists. After a PHP version change this is usually the whole story.

    sudo systemctl status php8.2-fpm --no-pager
    ls -l /run/php/php8.2-fpm.sock

    Expect Active: active (running) and a socket line beginning with srw-rw----. If the socket is absent, compare its path against what the vhost actually references, then reload both services. The configuration directives are documented upstream.

  8. Read the web-server error log for the exact backend complaint.

    sudo tail -50 /var/log/apache2/error.log
    sudo tail -50 /var/log/nginx/error.log

    On Apache, AH01079: failed to make connection to backend or AH00957 is a 503 caused by an unreachable FastCGI socket. On Nginx, no live upstreams while connecting to upstream is a 503; connect() to unix:... failed is a 502 and points at the socket instead.

Validate it works

Confirm the fix from outside, not from a logged-in browser tab that may be bypassing the cache.

curl -sS -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com/
curl -sS -o /dev/null -w '%{http_code}\n' https://example.com/wp-login.php

Both should print 200. A homepage that returns 200 while wp-login.php still returns 503 usually means a cache is serving a stored copy of the front page over a still-broken backend.

Then confirm WordPress itself is consistent, not merely reachable:

wp maintenance-mode status
wp core verify-checksums
wp plugin list --update=available

Expect Maintenance mode is not active., Success: WordPress installs verify against checksums., and an empty or short update list. A checksum failure here means the interrupted update left modified core files and needs wp core download --force before you call this closed.

Finally, watch the logs for a minute under real traffic to be sure the pool is not simply about to saturate again:

sudo tail -f /var/log/php8.2-fpm.log

Troubleshooting

  • The maintenance page persists after deleting .maintenance. Core ignores files older than ten minutes, so a page that survives deletion is not core’s. Check for a maintenance or coming-soon plugin, and clear any page cache and CDN cache: a 503 with Retry-After can be stored and replayed by an aggressive edge cache long after the origin recovered.
  • The 503 only appears under load. That is the PHP-FPM signature, not the WordPress one. Correlate the timestamps of the max_children warnings against your access log. The usual culprits are an uncached admin-ajax endpoint, an unindexed query behind a slow plugin, or wp-cron.php firing on every request on a busy site. A stuck maintenance page under load specifically is covered in the stuck “Briefly unavailable” guide.
  • You are on cPanel and cannot read the PHP-FPM log. Use Metrics > Errors and Metrics > Resource Usage in cPanel instead. Note that on CloudLinux hosts an account that exceeds its entry-process cap gets a dedicated 508 Resource Limit Is Reached page, not a 503, so a 503 there points at the domain’s own PHP-FPM pool settings rather than the account cap.
  • The site 503s only for logged-out visitors, or only for logged-in ones. That asymmetry is a caching layer, not an application fault. Logged-in requests skip the page cache, so they hit whichever backend is actually broken while cached anonymous pages keep serving.
  • A plugin fatal is showing as 503 rather than 500. Some PHP handlers surface a worker that died mid-request as an unavailable backend. Set WP_DEBUG_LOG to true in wp-config.php and read wp-content/debug.log; a genuine fatal names its file and line there regardless of the status code the visitor saw.

When this is the wrong approach

If the 503 arrived immediately after a PHP version rebuild on a cPanel server, the vhost and handler configuration is the subject, not WordPress, and the sequence is different enough to deserve its own page. The same is true of a 503 that appears mid-migration on a newly provisioned cPanel account, where DNS and the account’s own service state matter more than anything inside wp-content.

This page also stops at diagnosis and single-server repair. If the answer turns out to be that the pool is correctly sized and still saturating, no amount of log reading fixes that; the site has outgrown its allocation and needs capacity work, caching, or both. And if you are behind a load balancer with several origins, a 503 means every backend is failing its health check, which is an infrastructure question rather than a WordPress one.

Prevention is short. Never close the tab during a WordPress update, and prefer WP-CLI over the browser for anything large, since it cannot be interrupted by a browser timeout. Set WP_MAX_MEMORY_LIMIT high enough that the update process itself does not run out of memory partway. Size pm.max_children from measured per-request memory rather than from a number copied off a forum. And if you need planned downtime, use a maintenance plugin that sets its own Retry-After and can be switched off from the admin, rather than relying on core’s file, which has no user interface at all. The official common WordPress errors reference covers the neighbouring status codes if the one you are chasing turns out not to be 503 after all.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.