Monitoring

Your website is down: what to check in the first 15 minutes

In this article8 sections

Your phone buzzes. A customer says the site will not load, or the uptime monitor has gone red, or you open it yourself and see an error page. The first fifteen minutes decide whether this is a small interruption or a long afternoon, and the biggest danger in those minutes is not the outage. It is panic: restarting things at random, changing three settings at once, and ending up unable to tell which change made it better or worse.

This playbook gives you an order to work in. It starts with what you can check from outside in two minutes, narrows the problem to one layer of the stack, and then shows the commands that name the cause. It works for WordPress, Laravel and custom sites on a VPS, and for most of it you need only SSH access.

Minutes 0 to 2: what exactly is broken, and for whom?

“Down” can mean several different things, and each points at a different layer. Check from outside the server, from a network that is not yours (your phone on mobile data is perfect), and write down what you see.

curl -sI -m 10 https://example.com/ | head -5
dig +short example.com
dig +short MX example.com

Now match the result:

  • The name does not resolve, or resolves to a wrong address. A DNS problem: expired domain, changed nameservers, or a provider outage. Check the domain’s expiry and nameservers with whois example.com.
  • The request hangs and times out. The server is unreachable or the firewall drops the connection. Check the provider’s status page and whether the server answers ping and SSH.
  • “Connection refused”. The machine is up but nothing listens on that port: the web server is stopped.
  • A certificate warning. The site is running; the certificate has expired or does not match (see SSL certificate problems: how to diagnose and fix).
  • An error page with a code: 500, 502, 503 or 504. The web server answers, and something behind it is failing.
  • A blank page, or a page that loads but part is missing. Usually PHP or the database.

Also check whether it is down for everyone. If your site loads on mobile data but not on your office network, the problem is on your side.

Minutes 2 to 5: log in, and look at the machine

If you can reach the server, run these four checks. They find most outages in under a minute.

uptime
df -h /
free -m
systemctl --failed
  • uptime: a very high load average means the server is overwhelmed, and a recent boot time means it restarted.
  • df -h / and df -i /: a filesystem at 100% explains an astonishing number of outages (see how to find what is eating your disk).
  • free -m: almost no available memory and heavy swap use means the server is running out of memory.
  • systemctl --failed: lists services that have stopped. A stopped web server, PHP or database service is your answer.

Check whether the kernel killed something for lack of memory. When the system runs out, it terminates a process, often the database:

sudo journalctl -k --since "2 hours ago" | grep -i "killed process"

If the server itself is unreachable by SSH, use your provider’s console (a web or VNC console). Do not reboot yet; look first, because a reboot hides the evidence.

Minutes 5 to 10: find the failing layer

Work from the outside in. Each check takes seconds.

Is the web server running and listening?

sudo systemctl status nginx --no-pager | head -12
sudo ss -tulpn | grep -E ':80 |:443 '
sudo nginx -t

(Replace nginx with apache2 or httpd as needed.) If it is stopped, nginx -t or apachectl configtest tells you if a configuration error stopped it from starting, and the error log says why.

Is PHP running? A 502 or 504 from NGINX means it could not get an answer from PHP-FPM:

sudo systemctl status php8.3-fpm --no-pager | head -12
sudo tail -n 30 /var/log/nginx/error.log

Use your PHP version in the service name. Look for “connect() failed” (PHP-FPM not running), “upstream timed out” (a request took too long), or “no live upstreams”. The SiteHarbour blog has detailed guides for 502 Bad Gateway on NGINX and 504 Gateway Timeout.

Is the database running? “Error establishing a database connection” on WordPress, or a Laravel error page, point here:

sudo systemctl status mariadb --no-pager | head -12
sudo mysqladmin status
sudo tail -n 30 /var/log/mysql/error.log

(The service may be called mysql.) A database that will not start is very often a full disk or a crash after running out of memory. WordPress owners can use the SiteHarbour guide to fixing the database connection error.

Is the application itself failing? If the web server, PHP and database are healthy but the site shows a 500, read the application’s own log: wp-content/debug.log on WordPress (see recovering WordPress after a failed update), storage/logs/laravel.log on Laravel.

What changed? The most useful question in any outage

Most outages follow a change. Ask, honestly, what happened in the last day:

sudo journalctl --since "yesterday" -p warning --no-pager | tail -40
grep -E " install | upgrade " /var/log/dpkg.log | tail -15
last -n 10
sudo ls -lt /etc/nginx /etc/php 2>/dev/null | head
  • A package update (new PHP or web server version) may have restarted a service with an incompatible configuration.
  • A deployment or plugin update may have introduced an error.
  • A configuration edit by someone on the team.
  • A certificate or domain renewal that did not happen.
  • A traffic spike or a bot, visible as a flood of requests in the access log:
sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

If the answer is “I changed X an hour ago”, undoing X is usually the fastest fix.

Fix it the safe way

  1. Restart only the service that failed, not the whole machine, and read its log immediately after. If it fails again, the log is your evidence.
  2. Undo the last change before inventing a new one: roll back the deployment, restore the previous configuration file, deactivate the plugin.
  3. Free space or memory if those were the cause, and then address why they ran out.
  4. Change one thing at a time, and test after each change. Keep a note of the time and the command.
  5. Never delete data to “make room” in a hurry without checking what it is.
  6. If the machine is compromised or behaving strangely, stop and treat it as a security incident rather than a breakdown (see the cleanup runbook for hacked WordPress sites).

Tell people

During an outage, silence is worse than bad news. Post a short message where your customers will see it: what is affected, that you are working on it, and when you will update again. Do not guess a cause or a time you cannot meet. Keep a running log, with timestamps, of what you checked and changed. You will want it afterwards.

After: make it not happen twice

Within a day of recovery, write five lines: what happened, when it started and ended, why, how it was fixed, and what will prevent or catch it next time. Then do the prevention:

  • Monitor from outside with a keyword check, and alert on disk, memory, certificates and backups (see monitoring a small server).
  • Keep a runbook for the failures you have already seen.
  • Test your backups so that “restore” is a routine, not an experiment.

When it is worth getting help

If you are not back up within about thirty minutes, if data may be lost, if the server may have been hacked, or if you simply cannot tell which layer is failing, bring someone in early. Another pair of eyes at minute thirty is cheaper than a confident mistake at minute ninety.

I troubleshoot website downtime, HTTP 500, 502 and 504 errors, high load, memory exhaustion and database failures on Linux servers, finding the cause in the logs and fixing it properly. You can see my profile on Upwork and describe what you see, or read about monitoring and upkeep.