How to Fix Server Errors (5xx) Found in Your Site Audit

Your crawl found pages that answered with a 5xx status code (500, 502, 503, 504) or returned no response at all because the connection timed out, was reset or failed during the TLS handshake. In this guide you will reproduce each failing URL, find the cause in your server logs, fix the broken routes or capacity limits, and confirm that every page returns a clean response. The check fails when 1% or more of crawled pages error out, so even a few bad templates can trigger it.

By Updated ⏱ 1-3 hours🎯 Intermediate● High impactTechnical
Illustration: Server errors (5xx) fix guide
TECHNICAL · FIX GUIDE Server errors (5xx) IMPACTEFFORT TIME1-3 hours LEVELIntermediate

Why it matters

A 5xx tells Googlebot and AI crawlers that the page is unavailable. Occasional errors slow crawling, because Google reduces its crawl rate when a host keeps failing. Errors that persist for days can get URLs dropped from the index and from AI answer sources.

Visitors who hit a 502 or a blank timeout usually leave and do not come back, and checkout or form errors cost you revenue directly. A rising error rate is also a common early sign of resource exhaustion, a bad deploy or bot abuse.

✕Beforehttps://example.com/products/blue-mug→ 502 Bad Gateway, and /blog/page/40 →no response after 30 seconds (status✓Afterhttps://example.com/products/blue-mug→ 200 OK in 0.4s; deleted URLs return404 or 301 instead of 500

What you need

The list of failing URLs from your audit report
Access to server, hosting or platform logs (SSH, hosting dashboard or log viewer)
A terminal with curl, or a browser with DevTools
Permission to change application code, server config or the hosting plan

Step-by-step fix

1

Reproduce each failing URL

Export the failing URLs from the audit and request each one yourself. Note the exact status code and how long the response takes. A status of 0 in the audit means no HTTP response came back, which is usually a timeout, a dropped connection, a firewall block or a TLS/DNS failure.

Run the test several times. An error that comes and goes points to load or upstream problems, while an error on every request points to a code bug.

text
# Status code and total time for one URL
curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" --max-time 30 https://example.com/products/blue-mug

# Check a whole list (urls.txt = one URL per line)
while read u; do curl -s -o /dev/null -w "%{http_code} %{time_total}s $u\n" --max-time 30 "$u"; done < urls.txt
Pro tip: Also test with a crawler user agent (-A "Mozilla/5.0 (compatible; Googlebot/2.1)"). Some WAF and bot rules drop or error out only for crawlers.
2

Match the errors in your server logs

Look up the same URLs and timestamps in your access log and error log. The access log confirms which status was sent. The error log, PHP-FPM log or application log shows why.

Search for upstream timeouts, fatal errors, out-of-memory kills and 'too many connections' messages.

text
# All 5xx responses in the Nginx access log, most frequent URLs first
awk '$9 ~ /^5/ {print $9, $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20

# Recent errors
tail -n 200 /var/log/nginx/error.log
grep -iE "fatal|out of memory|max_children" /var/log/php*-fpm.log

# Process killed by the kernel?
dmesg -T | grep -i "killed process"
Pro tip: On managed hosting, check the hosting panel's 'Logs' or 'Error log' section, or ask support for logs filtered to the failing timestamps.
3

Classify each error by its status code

Each status code points to a different layer, so group the failures before you fix anything:

  • 500: the application crashed. Look for a code bug, a missing record, a bad plugin or a PHP fatal error.
  • 502: the proxy got no valid answer from the app. The app process is down, crashed or restarting.
  • 503: the server is overloaded or in maintenance mode, or worker pools are full.
  • 504 or status 0: the request took too long, or the connection was dropped by a firewall, load balancer or failing TLS.
Pro tip: If the errors cluster on one template (for example all /search?q= or deep pagination URLs), the cause is almost always a slow or broken query on that template, not the whole server.
4

Fix crashing routes in the application

Read the stack trace for each 500 and fix the root cause. A common one is a page that assumes a product, post or user exists and crashes when it has been deleted. That case should return a 404 (or a 301 to a replacement), not a 500.

Also check for PHP or Node version incompatibilities after upgrades, expired API keys and third-party APIs called without a timeout during rendering.

javascript
// Next.js App Router: return 404 instead of crashing on missing data
import { notFound } from 'next/navigation';

export default async function Page({ params }) {
  const { slug } = await params;
  const product = await getProduct(slug).catch(() => null);
  if (!product) notFound();
  return <ProductView product={product} />;
}
Pro tip: Give every external call made during page rendering (payment, reviews, inventory APIs) a short timeout and a fallback, so one slow dependency cannot take the page down.
5

Remove load and timeout bottlenecks

If errors appear under traffic or during crawls, the server is running out of workers, memory or database connections. Raise worker limits to match the RAM you have. Add full-page caching for anonymous visitors.

Fix slow database queries (enable the slow query log). Set proxy timeouts so they are long enough for legitimate pages but still fail fast.

nginx
# /etc/php/8.3/fpm/pool.d/www.conf  (size to RAM: ~available MB / avg MB per process)
pm = dynamic
pm.max_children = 40
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12
pm.max_requests = 500

# Nginx server block
proxy_connect_timeout 10s;
proxy_read_timeout 60s;
fastcgi_read_timeout 60s;
Pro tip: If logs show aggressive scrapers driving the load, rate-limit them (Nginx limit_req or a WAF rule) rather than upgrading hardware. If real traffic has outgrown the plan, move to a larger plan or add autoscaling.
6

Return a proper 503 during planned maintenance

Deploys and maintenance windows often cause 502s or connection resets. Serve a 503 Service Unavailable with a Retry-After header instead. Search engines treat a short 503 as temporary and come back later.

Keep maintenance windows short, because a 503 that lasts several days is treated like a permanent error.

nginx
# Nginx: enable by creating /var/www/maintenance.flag
if (-f /var/www/maintenance.flag) { return 503; }
error_page 503 @maintenance;
location @maintenance {
  add_header Retry-After 3600 always;
  root /var/www/static;
  rewrite ^ /maintenance.html break;
}
Pro tip: Use zero-downtime deploys (rolling restarts, symlink swaps, or 'pm2 reload' for Node) so normal releases never produce 502s.
7

Re-crawl and set up monitoring

Re-test the failing URLs with the curl loop from step 1. Then run a fresh audit and confirm errors are well below 1% of crawled pages, ideally zero. Add uptime monitoring on key templates (home, category, product, article) and watch for new spikes over the next week.

Pro tip: In Google Search Console, open Settings → Crawl stats → By response to watch the share of 5xx responses Googlebot sees over time.

Platform-specific notes

WordPress

Turn on logging in wp-config.php with define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); then read wp-content/debug.log. If a plugin causes the 500, rename its folder in wp-content/plugins via SFTP to disable it. Full-page caching (a caching plugin or host-level cache) and a larger PHP memory_limit fix most load-related 503s and 504s.

Shopify

You cannot change Shopify's servers. Real 5xx responses are rare and usually short platform incidents (check shopifystatus.com). Persistent errors typically come from app proxy routes (/apps/...) or headless storefronts. Contact the app developer, or fix your Hydrogen/Oxygen code and check its logs.

Next.js / Vercel

Open the project's Logs tab in the Vercel dashboard and filter by status 5xx. FUNCTION_INVOCATION_TIMEOUT means a serverless function ran past its maxDuration. Fix it by caching data, using ISR (export const revalidate) or raising maxDuration in the route config. Use notFound() for missing records so they return 404 instead of 500.

Cloudflare

Cloudflare-specific codes point to the origin: 521 means the origin refused the connection, 522 means the connection timed out, 524 means the origin took longer than 100 seconds on non-Enterprise plans, and 525/526 mean SSL handshake or certificate problems. Make sure your origin firewall allows Cloudflare IP ranges, and check that the SSL/TLS mode (Full (strict)) matches a valid origin certificate.

Nginx + PHP-FPM / Node

'upstream timed out' in error.log means a 504, so tune proxy_read_timeout or fix the slow page. 'connect() failed (111: Connection refused)' means a 502 because the app is down; run it under systemd or pm2 with automatic restart. 'server reached pm.max_children' means you need more FPM workers or caching.

Check that it worked

✅ How to verify

  • Run curl -s -o /dev/null -w "%{http_code}" on every previously failing URL several times and get 200, 301 or 404, never 5xx or a timeout.
  • Re-run the site audit and confirm the server error check passes, with errors under 1% of crawled pages and ideally none.
  • Search your access log for 5xx over the past 24 hours: awk '$9 ~ /^5/' /var/log/nginx/access.log | wc -l should be at or near zero.
  • In Google Search Console, check that Crawl stats → By response shows the server error share falling, and use URL Inspection → Test live URL on key pages.

⚠️ Common mistakes

  • Hiding errors by returning 200 with an error message on the page. This creates soft-404/soft-error pages that rank poorly and hide the real problem.
  • Upgrading the hosting plan without reading the logs, when the real cause is one slow query, a crashing plugin or a bot hammering search URLs.
  • Returning 500 for deleted products or posts instead of 404/410 or a 301 to a relevant replacement.
  • Leaving a site in maintenance mode or a WAF challenge active for days, so crawlers keep getting 503s or dropped connections.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Do 5xx errors hurt my Google rankings?

Brief, occasional errors usually do not. Google retries and may only slow its crawl rate. If a URL keeps returning 5xx for several days, Google can drop it from the index. Fixing the errors restores crawling, and pages typically return once they respond normally again.

What does a status of 0 mean in a crawl report?

The crawler got no HTTP response at all. Common causes are a request timeout, a connection refused or reset by the server or firewall, a DNS failure, or a TLS/certificate error. Treat it like a 5xx and check firewall rules, timeouts and SSL configuration.

What is the difference between a 502, 503 and 504 error?

A 502 Bad Gateway means the proxy or CDN got an invalid response because the app behind it crashed or is down. A 503 Service Unavailable means the server is overloaded or in maintenance. A 504 Gateway Timeout means the app took too long to answer the proxy.

Should I use 503 or 500 when my site is down for maintenance?

Use 503 with a Retry-After header. It tells search engines the outage is temporary, so they keep the page indexed and come back later. A 500 signals an unexpected failure.