A client's site shows a server error: what to do
The name works and the server answers, but it answers with an error page instead of the site. The number on that page tells you which part broke. Here is the order we would work in.
1. Read the number
- 500 Internal Server Error. The site's own code failed. On WordPress this often shows as "There has been a critical error on this website". Look at what changed last: a plugin, a theme, a PHP version. What to do about the WordPress critical error. If it says "Error establishing a database connection" instead, a plugin is rarely the cause: the database server is down, or its login details changed. What to do about the database error.
- 502 Bad Gateway. The front server is up, but the program behind it, usually PHP or an app process, is not answering properly. It has crashed or been stopped.
- 503 Service Unavailable. The server is overloaded, or the site is in maintenance mode on purpose. WordPress says "Briefly unavailable for scheduled maintenance" during an update.
- 504 Gateway Timeout. The program behind the front server is alive but too slow, usually a heavy page, a stuck database query or a busy server.
- 508 Resource Limit Is Reached. Common on shared hosting: the account is running more things at once than its plan allows, usually too many PHP processes, and the host is turning visitors away.
- 520 to 526, on a Cloudflare page. Cloudflare is fine; the client's own server behind it is not. 521 means it refused the connection, 522 and 524 mean it did not answer in time, 525 means the secure connection to it failed, and 526 means its security certificate is expired or not valid.
No number at all, just "can't be reached" or a timeout? That is a different problem. See what to check when a site is down.
2. Make sure it is not just you
Your browser may be showing an old copy. Ask from a terminal instead; this follows any redirects and prints the code the page finally answers with:
curl -sL -o /dev/null -w "%{http_code}\n" https://example.comOn Windows, use NUL instead of /dev/null. Better still, try from your phone on mobile data too, so you are not only asking from your own network. Run it two or three times. An error every time is an outage. An error now and then is a server under strain, which usually gets worse, not better.
3. Look at the error log
The page only says that something failed. The log says what. In most hosting panels it is under Logs or Errors; on cPanel, Metrics then Errors. The newest lines, at the time the errors started, usually name the file or plugin. For a 508, the host's resource usage page shows which limit was hit.
4. The usual fixes
- A plugin or theme update broke it. Rename that plugin's folder in
wp-content/pluginsover FTP or the host's file manager. WordPress switches it off and the site usually comes back. Then update or replace it properly. - WordPress is stuck in maintenance mode. An update was interrupted and may have left a file called
.maintenancein the site's main folder. Delete it, then check the update actually finished. If there is no such file, the cause is elsewhere. - PHP or the app process stopped (502). Restart it from the hosting panel, or ask the host to. If it keeps stopping, it is running out of memory.
- The server is overloaded (503, 504, 508). Check for a traffic spike or a bot hammering one page. A caching plugin or a bigger plan fixes the first; blocking the bot fixes the second.
- Cloudflare 52x. Treat it as the server being down: check the host first. For 525, check the server has a certificate set up at all. For 526, check that certificate has not expired and covers the site's address.
5. Check the fix
Run the command from step 2 again. It should print 200. Then load a few real pages in a private window, including one that is not the home page, because a broken plugin can take down some pages and leave others working.
6. Tell the client what happened
They may have seen the error page themselves. For example:
The website showed an error page for a while because an update did not install cleanly. I have fixed it and checked the main pages are loading normally again.
7. Next time, hear about it first
Bionic Uptime reads the code on every check, and any 500-range answer is a failed check. When both of our locations, on two different companies' networks, and a retry agree within 45 seconds, it is confirmed as an outage and each person on that website's alert list gets one email. The email includes the error code, for example "received a server error (HTTP 503)". A gateway that takes longer than ten seconds to give up, as a 504, 522 or 524 often does, shows as a timeout instead. See the exact outage email.
An error that has cleared by the retry does not send an outage email. That keeps the few seconds of maintenance during an automatic update from waking you, but it also means a site that fails only now and then is not called down. If the checks keep disagreeing for five minutes, you get one "Status uncertain" email instead. And a site that shows an error message with a normal 200 code looks healthy to a plain check. Turn on Also check what the page says when you add the website, with a phrase the client's page must say, and that page fails it.
3 websites are free, forever, with no card. Looking after several client sites?