How to Fix a 503 Service Unavailable Error (Step by Step)

A 503 Service Unavailable error means the server is temporarily unable to handle your request. Here's how to find the cause and fix it, whether you're a site visitor or server admin.

Written by Timothy Bramlett ยท

You load a page and get "503 Service Unavailable." If you're a visitor, it means the site is temporarily down. If you own the site, something is overwhelming or blocking your server. Either way, the fix depends on the root cause.

This guide covers what a 503 error actually means, quick fixes you can try immediately, and detailed server side solutions for Nginx, Apache, Cloudflare, and WordPress. It also covers the Retry-After header for planned maintenance, something most guides skip entirely.

What Is a 503 Service Unavailable Error?

A 503 Service Unavailable error is an HTTP status code that means the server is temporarily unable to handle your request. The key word is "temporarily." The server is not broken. It is not misconfigured. It is simply too busy or deliberately taken offline for maintenance.

This is different from a 502 Bad Gateway (which means one server got an invalid response from another server) or a 500 Internal Server Error (which means the server code itself crashed). A 503 specifically means the server knows it can't handle the request right now and is telling you to try again later.

The most common scenarios:

  • Traffic spike: More requests are arriving than the server can process
  • Planned maintenance: The server has been taken offline intentionally for updates
  • Resource exhaustion: CPU, memory, or connection limits have been reached
  • DDoS attack: Malicious traffic is flooding the server
  • Rate limiting: The server or a firewall is rejecting requests because they arrive too fast

You might see the error displayed differently depending on the server or browser:

  • 503 Service Unavailable
  • 503 Service Temporarily Unavailable
  • HTTP Error 503
  • Error 503 Backend is unhealthy (common with load balancers)
  • 503 Server Unavailable
  • HTTP 503

They all mean the same thing. Let's fix it.

Quick Fixes (Try These First)

If you're seeing a 503 error on someone else's site, or you want to rule out simple issues before digging into server configs, start here.

1. Wait and Reload

A 503 is explicitly temporary. The server is telling you it expects to recover. Wait 30 to 60 seconds and press Ctrl + F5 (Windows) or Cmd + Shift + R (Mac) to do a hard reload. Many 503 errors resolve on their own within a minute, especially if caused by a brief traffic spike or a service restart.

2. Check If the Site Is Down for Everyone

Use a tool like our free ping test to check whether the site is down globally or just for you. If it's down for everyone, the problem is server side. If it loads for others, the issue might be your ISP, network, or a regional CDN node.

3. Clear Your Browser Cache

Your browser might have cached the 503 error page. Clear your cache or open the site in an incognito window. If it works in incognito, the issue was a cached error response.

4. Check the Site's Status Page

Many sites have a public status page (often at status.example.com) that shows current incidents and planned maintenance. Check there before assuming the worst. If a maintenance window is listed, the 503 is intentional and the site should return once it's done.

Still seeing the error?

If the 503 persists after a few minutes and the site is yours, the problem is server side. Read on for specific fixes by server type.

Common Causes of 503 Service Unavailable Errors

Before jumping into platform specific fixes, understanding the root cause will save you time. Here are the most common triggers.

Cause What Happens How to Check
Server overload CPU or memory maxed out, server can't accept new connections top or htop
Maintenance mode Server or application deliberately returning 503 Check for maintenance flags or .maintenance files
Worker processes exhausted All PHP-FPM, Gunicorn, or Node workers are busy systemctl status php-fpm
Rate limiting Firewall or application rejecting requests that exceed a threshold Check Cloudflare, Nginx, or WAF rate limit rules
DDoS attack Massive volume of malicious traffic saturating the server ss -s or check connections per IP
Database overload Too many slow queries lock up the database, application threads wait SHOW PROCESSLIST; in MySQL
Hosting resource limits Shared hosting provider caps CPU, processes, or connections Check hosting control panel or contact provider

Fixing 503 Errors on Nginx

Nginx returns a 503 when all upstream servers in a load balancing group are marked as unavailable, when the server is configured to return 503 during maintenance, or when connection/request limits are hit.

Step 1: Check the Error Log

Start here. The error log will tell you exactly why Nginx is returning 503.

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

Common 503 related messages and what they mean:

  • no live upstreams while connecting to upstream — All backend servers in the upstream block are marked as down
  • limiting requests, excess: X — Nginx rate limiting is rejecting requests
  • limiting connections by zone — Connection limit per IP or per server has been reached

Step 2: Check Server Resources

The most common cause of 503 errors is simply running out of resources. Check CPU, memory, and disk usage:

# Check CPU and memory in real time:
htop

# Check disk space:
df -h

# Check how many connections are open:
ss -s

If CPU is above 90% or memory is nearly full, the server is overloaded. You'll need to either optimize your application, increase server resources, or add load balancing.

Step 3: Increase Worker Connections

Nginx has a limit on how many simultaneous connections it handles. If you've outgrown the default, increase it:

# /etc/nginx/nginx.conf

worker_processes auto;          # One worker per CPU core

events {
    worker_connections 2048;    # Max connections per worker (default is 512 or 1024)
    multi_accept on;            # Accept multiple connections at once
}

Then test and reload:

sudo nginx -t && sudo systemctl reload nginx

Step 4: Adjust Rate Limiting

If Nginx is configured with rate limiting (using limit_req or limit_conn), legitimate users might be getting 503 errors during traffic spikes. Check your config for these directives:

# Find rate limit configs:
grep -r "limit_req" /etc/nginx/
grep -r "limit_conn" /etc/nginx/

# A typical rate limit zone:
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;

# In the server block:
limit_req zone=one burst=20 nodelay;  # Allow bursts up to 20

If the rate or burst values are too low for your traffic, increase them. The burst parameter is especially important: it controls how many requests can queue before Nginx starts rejecting them.

Step 5: Check Upstream Health

If you're using Nginx as a load balancer, it may have marked all backends as down. Check your upstream block:

# In your Nginx config:
upstream backend {
    server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
    server 127.0.0.1:8081 max_fails=3 fail_timeout=30s;
}

# max_fails=3 means after 3 failed requests, Nginx marks the server as down
# fail_timeout=30s means it stays down for 30 seconds before Nginx tries again

If all servers in the upstream block are down, Nginx returns 503. Verify each backend is actually running:

curl -I http://127.0.0.1:8080
curl -I http://127.0.0.1:8081

Fixing 503 Errors on Apache

Apache returns a 503 when it runs out of worker threads, when all backend servers in a proxy pool are unavailable, or when the server is in maintenance mode.

Step 1: Check Apache Error Logs

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

Look for messages containing server reached MaxRequestWorkers or AH00489. These tell you Apache has run out of worker threads.

Step 2: Increase MaxRequestWorkers

If Apache ran out of workers, increase the limit. Find your MPM config (usually in /etc/apache2/mods-enabled/mpm_prefork.conf or mpm_event.conf):

# For mpm_event (recommended):
<IfModule mpm_event_module>
    StartServers             4
    MinSpareThreads         25
    MaxSpareThreads         75
    ThreadLimit             64
    ThreadsPerChild         25
    MaxRequestWorkers      400    # Increase this (default is often 150)
    MaxConnectionsPerChild   0
</IfModule>

Test and restart:

sudo apachectl configtest && sudo systemctl restart apache2

Step 3: Disable mod_evasive (Temporarily)

If you have mod_evasive installed (a DDoS protection module), it might be too aggressive and blocking legitimate traffic. Check its configuration:

# /etc/apache2/mods-enabled/evasive.conf
<IfModule mod_evasive20.c>
    DOSHashTableSize    2048
    DOSPageCount        5       # Requests to same page per interval (increase if too strict)
    DOSSiteCount        100     # Requests to any page per interval
    DOSPageInterval     1       # Interval in seconds
    DOSSiteInterval     1
    DOSBlockingPeriod   10      # Block duration in seconds
</IfModule>

If DOSPageCount or DOSSiteCount values are very low, legitimate users browsing quickly will trigger 503 responses. Increase the thresholds or temporarily disable the module to test:

sudo a2dismod evasive && sudo systemctl restart apache2

Step 4: Check Backend Proxy Health

If Apache is configured as a reverse proxy, verify the backend is alive:

# Test the backend directly:
curl -I http://127.0.0.1:8080

# Check if the backend service is running:
sudo systemctl status your-app-service

Fixing 503 Errors With Cloudflare

When Cloudflare is involved, a 503 can come from two sources: your origin server or Cloudflare itself. The error page design tells you which.

Cloudflare's 503 vs Your Origin's 503

  • Cloudflare branded error page with "Cloudflare" header: Cloudflare is generating the 503. This happens when Cloudflare's rate limiting, WAF rules, or "I'm Under Attack" mode blocks the request.
  • Plain 503 page or your custom error page: Your origin server returned the 503. Cloudflare just passed it through. The problem is on your server.

Step 1: Check "I'm Under Attack" Mode

Cloudflare's "I'm Under Attack" mode adds a JavaScript challenge to every request. In rare cases, if the challenge fails or the visitor's browser can't run JavaScript, they see a 503. Go to your Cloudflare dashboard > Security > Settings and check if "I'm Under Attack" is enabled. If you're not actually under attack, switch back to "Medium" or "Low" security level.

Step 2: Review Rate Limiting Rules

Go to Security > WAF > Rate limiting rules. If you have rate limits that are too strict, legitimate users will get 503 responses. Check the thresholds and make sure they match your actual traffic patterns. A common mistake is setting rate limits based on quiet periods, then seeing 503 spikes during normal business hours.

Step 3: Test Your Origin Directly

Bypass Cloudflare to see if the 503 comes from your server:

# Replace YOUR_ORIGIN_IP with your server's actual IP:
curl -I --resolve yourdomain.com:443:YOUR_ORIGIN_IP https://yourdomain.com

If your origin returns 503, the problem is on your server (see the Nginx or Apache sections above). If the origin is fine, the issue is in your Cloudflare configuration.

Step 4: Check for Cloudflare Connection Limits

The Cloudflare community tip on 503 errors notes that "Error 503: Service Temporarily Unavailable" with Cloudflare branding means you are hitting a connection limit in a Cloudflare data center. This usually resolves on its own, but if it persists, contact Cloudflare support or check if your plan has specific connection limits.

Fixing 503 Errors on WordPress

WordPress has several unique triggers for 503 errors. Plugin conflicts, resource exhaustion, and the built in maintenance mode are the most common.

Step 1: Check for the .maintenance File

When WordPress runs updates, it creates a .maintenance file in the site root. If an update fails or times out, this file can get left behind, keeping your site stuck in maintenance mode.

# Check if the file exists:
ls -la /var/www/html/.maintenance

# If it exists, delete it:
rm /var/www/html/.maintenance

Your site should come back immediately after removing this file.

Step 2: Disable All Plugins

A plugin that consumes excessive memory or makes slow external API calls can exhaust PHP workers, triggering a 503. If you can't access wp-admin:

# Via WP-CLI:
wp plugin deactivate --all

# Or rename the plugins directory:
mv wp-content/plugins wp-content/plugins-disabled

If the site comes back, re-enable plugins one by one to find the culprit.

Step 3: Limit the WordPress Heartbeat API

The WordPress Heartbeat API sends AJAX requests every 15 to 60 seconds from every open browser tab. If multiple editors are logged in simultaneously, this can overwhelm the server. Add this to your theme's functions.php or use a plugin like Heartbeat Control:

// Slow down the Heartbeat API to every 60 seconds:
add_filter('heartbeat_settings', function($settings) {
    $settings['interval'] = 60;
    return $settings;
});

Step 4: Increase PHP Memory and Workers

WordPress often hits PHP memory limits under load, especially with WooCommerce or page builders. Increase the limits:

// In wp-config.php:
define('WP_MEMORY_LIMIT', '256M');

Also increase PHP-FPM workers so more requests can be handled simultaneously:

# /etc/php/8.2/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20

# Restart PHP-FPM:
sudo systemctl restart php8.2-fpm

Step 5: Check for DDoS or Bot Traffic

WordPress sites are frequent targets for brute force attacks on wp-login.php and xmlrpc.php. Check your access logs for suspicious patterns:

# Check for heavy hitters on wp-login.php:
grep "wp-login.php" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20

# Check xmlrpc.php:
grep "xmlrpc.php" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20

If you see thousands of requests from a single IP, block it at the firewall level:

sudo ufw deny from 123.45.67.89

To block xmlrpc.php entirely (most sites don't need it), add this to your Nginx config:

location = /xmlrpc.php {
    deny all;
    return 403;
}

The Retry-After Header (For Planned Maintenance)

The 503 status code is unique among error codes because it supports the Retry-After header. This header tells the client (browsers, search engine crawlers, API consumers) exactly when to try again. Most guides skip this entirely, but it's important if you're taking your site offline for planned maintenance.

Why It Matters for SEO

When Googlebot encounters a 503, it checks for the Retry-After header. If present, Google knows the downtime is intentional and temporary. It will come back after the specified time instead of assuming the site is broken. Without the header, repeated 503 responses may cause Google to reduce crawl frequency and eventually drop pages from the index.

How to Set It in Nginx

Create a maintenance page that returns 503 with the Retry-After header:

# In your Nginx server block:
# To enable maintenance mode, uncomment these lines:

# error_page 503 /maintenance.html;
# location / {
#     return 503;
# }
# location = /maintenance.html {
#     root /var/www/html;
#     add_header Retry-After 3600 always;    # Tell clients to retry in 1 hour
#     internal;
# }

How to Set It in Apache

# In .htaccess or VirtualHost config:
# ErrorDocument 503 /maintenance.html
# Header always set Retry-After "3600"
# RewriteEngine On
# RewriteCond %{REQUEST_URI} !^/maintenance\.html$
# RewriteRule ^(.*)$ - [R=503,L]

Retry-After Format Options

The header accepts two formats:

  • Seconds: Retry-After: 3600 (try again in 1 hour)
  • HTTP date: Retry-After: Thu, 20 Feb 2026 06:00:00 GMT (try again at this specific time)

Use seconds for maintenance windows where you're not sure exactly how long it will take. Use the date format when you know the exact end time.

How to Prevent 503 Errors

Fixing a 503 is reactive. Here's how to stop them from happening in the first place.

Set Up Uptime Monitoring

A 503 that lasts 5 minutes is a blip. A 503 that lasts 3 hours because nobody noticed is a disaster. An uptime monitoring tool checks your site continuously and alerts you the moment something goes wrong.

Notifier checks your site and sends alerts via email, SMS, and phone call when it detects downtime. The free plan includes 10 monitors with 5 minute checks. Set it up once, and you'll know about 503 errors within minutes instead of hours.

Implement Caching

Most 503 errors from traffic spikes can be prevented with proper caching. If your server doesn't need to run PHP or query a database for every request, it can handle 10x more traffic:

  • Page caching: Serve static HTML instead of running PHP for every page load (Nginx FastCGI cache, WP Super Cache, W3 Total Cache)
  • Object caching: Cache database query results in Redis or Memcached
  • CDN caching: Serve static assets from Cloudflare or a CDN instead of your origin server

Use a Load Balancer

If a single server can't handle your traffic, distribute it across multiple servers with a load balancer. If one server goes down, the load balancer sends traffic to the remaining healthy servers instead of returning 503 errors. Nginx, HAProxy, AWS ALB, and Google Cloud Load Balancer all support this.

Auto-Scale for Traffic Spikes

If you're on a cloud platform (AWS, Google Cloud, DigitalOcean), configure auto-scaling so additional servers spin up automatically when traffic exceeds a threshold. This prevents 503 errors during unexpected surges, product launches, or viral moments.

Schedule Maintenance Windows Properly

If you need to take a server offline for updates, do it during low traffic periods and use the Retry-After header to tell search engines when you'll be back. Announce the maintenance window on your status page so users know what to expect.

Frequently Asked Questions

Is a 503 error my fault?

If you're a visitor, no. A 503 is a server side issue. It means the website's server is too busy or undergoing maintenance. If you're the site owner, it usually means your server needs more resources, your rate limiting is too aggressive, or your application has a bottleneck.

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

A 502 Bad Gateway means a server got an invalid response from another server (one server talked to another, and the response was broken). A 503 Service Unavailable means the server knows it can't handle the request right now, usually because it's overloaded or in maintenance mode. In practice: 502 is a broken connection, 503 is a capacity or availability problem.

How long does a 503 error usually last?

It depends on the cause. Traffic spike 503s often resolve in seconds to minutes as load drops. Maintenance mode 503s last as long as the maintenance window (check the site's status page or the Retry-After header). Resource exhaustion 503s will persist until someone fixes the server. This is why uptime monitoring matters: you want to know immediately, not when customers start leaving.

Can a 503 error hurt my SEO?

Briefly, no. Google understands that 503 errors are temporary, especially if you include the Retry-After header. But extended 503 errors (lasting hours or days) will cause Googlebot to reduce crawl rate and may eventually drop pages from the index. Short maintenance windows with proper Retry-After headers will not affect your rankings.

My WordPress site shows "Briefly unavailable for scheduled maintenance." Is that a 503?

Yes. When WordPress runs updates, it creates a .maintenance file that triggers a 503 response with that message. If the update completes successfully, the file is deleted automatically. If the update fails or times out, the file stays and your site remains stuck showing 503. Delete the .maintenance file from your WordPress root directory to fix it immediately.

How do I know when my site gets a 503 error?

Set up uptime monitoring. A tool like Notifier checks your site every minute and alerts you via email, SMS, or phone call the instant it detects a 503 or any other error. The free plan covers 10 monitors. Without monitoring, you rely on customers reporting the problem, which can take hours.

Can Cloudflare cause 503 errors?

Yes. Cloudflare's "I'm Under Attack" mode, rate limiting rules, and WAF rules can all return 503 responses to legitimate visitors. If you see a 503 with Cloudflare branding, the issue is in your Cloudflare configuration, not your origin server. Check your security settings and rate limiting thresholds.

Get Alerted When Your Site Goes Down

Set up monitoring in 30 seconds. Get email, SMS, and phone call alerts when a 503 or any other error hits your site. Free plan includes 10 monitors.

Start Monitoring Free
Timothy Bramlett

Written by

Timothy Bramlett

Founder, Notifier.so

Software engineer and entrepreneur building tools for website monitoring and uptime tracking.

View author profile