Your site won't load and the browser shows only a three-digit code. Or worse: a white page with no code at all. At that moment, what you really need isn't a long explanation; it's a table that tells you what this code means, what the most likely cause is, and what the first command you should run is. This post is that table, along with a few tips you only learn after seeing these same errors a few times.
Error table: code, meaning, likely cause, first action
| Code / Message | Meaning | Likely cause | First action |
|---|---|---|---|
502 Bad Gateway | Proxy couldn't reach the backend | PHP-FPM is down or wrong socket | systemctl status php8.2-fpm |
503 Service Unavailable | Service is not responding, either intentionally or due to load | Workers exhausted, resource limits, maintenance mode | Web server error log and worker count |
504 Gateway Timeout | Backend didn't respond within the allowed time | Slow query, long-running script, slow DNS | MySQL slow log and slow_query_log |
500 Internal Server Error | Script execution error | Code bug, incompatible PHP version, incomplete file | tail -50 error.log |
403 Forbidden | Access denied | File permissions, deny rule, wrong .htaccess | ls -l on the path and access log |
404 Not Found | Path doesn't exist | Broken rewrite, moved file | Test with the direct file URL |
508 Resource Limit Is Reached | Plan resource cap reached | Concurrent entries or runaway processes | top and counting entries |
Too many connections | MySQL exceeded the connection limit | Leaked connections, code without close | SHOW PROCESSLIST; |
SSL_ERROR_RX_RECORD_TOO_LONG | HTTPS on an HTTP port | Port 443 is connected to a non-TLS service | Check the listen 443 ssl block |
Connection refused on SSH | Port 22 isn't responding | Service down or firewall | ss -tlnp | grep :22 |
This table doesn't replace troubleshooting, but in ninety percent of cases it shortens the path. If the error code isn't in the first column, go to the logs; the error code only tells you the category, the log tells you the details.
502 and 503 errors: when the web server is alive but the backend isn't
The most common mistake is assuming a 502 is fixed by restarting Nginx. Nginx is usually fine; what isn't responding is PHP-FPM or the application behind it. First check the service status:
systemctl status php8.2-fpm --no-pager
journalctl -u php8.2-fpm -n 50 --no-pager
If the service is active (running) but you're still getting a 502, the socket is probably wrong. In Nginx, compare the line fastcgi_pass unix:/run/php/php8.2-fpm.sock; with the actual socket path. A PHP version was upgraded and the socket still points to the previous version; this is one of the most common causes of a 502 after an update.
503 tells a different story. If you see the message Resource Limit Is Reached, the plan's resource cap is full and restarting only buys a few minutes. Use top -b -n1 | head -20 to see which process is consuming the most and whether concurrent entries have risen abnormally. If the traffic is real, it's time to upgrade resources; if not, a bot or a code loop is to blame.
504 errors: it's not always the database's fault
504 means the backend didn't respond within the set interval. The default fastcgi_read_timeout in Nginx is sixty seconds, and most people blame that, while the real problem is a query without an index that takes ninety seconds. Before touching the timeout, enable the slow log:
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 2;
If no slow query is logged after two minutes, the problem is elsewhere: the request may be stuck on an external service (payment gateway, SMS API, map service). In that case, increasing the timeout only makes the user wait longer and solves nothing.
This is where people go wrong
I've often seen people set fastcgi_read_timeout to 300 seconds to fix a 504. The result is that the error changes: instead of a 504, the user sees a white page or a 502, because PHP-FPM gives up before Nginx does. The sign is that the PHP-FPM log fills with child exited on signal 9. Raise the timeout, but at the same time align request_terminate_timeout in the FPM pool, otherwise you've only moved the error around.
Database errors: messages you should take seriously in the error table
Too many connections almost always means the code closes the connection but not on the error path. Use SHOW PROCESSLIST; to see how many connections are left in Sleep state. If the number is above a hundred and most are Sleep, the problem is the code, not the server. Raising max_connections without fixing the code only fills up memory and eventually sends the server to swap.
The error Table './db/wp_options' is marked as crashed is also a familiar message. The first action is REPAIR TABLE wp_options;, but if the same table crashes again next week, look for the root cause: sudden server shutdown, disk full, or a network filesystem. Repeated crashes of a table are a sign, not bad luck.
SSL and DNS errors: not error codes, but the same effect
ERR_CERT_DATE_INVALID means the certificate has expired or the server clock is behind. Before anything else, run date -u; a clock difference of a few minutes makes the certificate appear invalid. If the certificate renews automatically, check the certbot renew --dry-run log. The DNS_PROBE_FINISHED_NXDOMAIN error usually means the A record is missing or the TTL hasn't expired yet. Test with dig +short example.com A from a public resolver, not from your own browser cache.
A practical tip: if the account's contact email is old, certificate renewal and domain expiry warnings reach no one, and the day the site goes down, nobody knows why. Updating account contact information takes five minutes and prevents a whole category of these errors.
SSH and access errors: when you can't even get in
Permission denied (publickey) means the key wasn't accepted. First make sure you're using the right key: ssh -v user@host shows which key was offered. If the ~/.ssh directory permissions are 777, SSH ignores the key and gives this same message. Try chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys before any other change.
If you get Connection refused, the SSH service isn't up or the firewall is closed. Log in through the provider's emergency console and run ss -tlnp | grep :22. If the port is listening but you get no response from outside, the firewall or Security Group is to blame. For colleague access, before opening extra ports, set up colleague access to the host so you only grant what's needed.
Errors that aren't in the table but take the most time
A white page with a 200 code in the access log. This is the worst kind, because you have no code to search for. It almost always means display_errors is off and the PHP error isn't being logged anywhere. First configure error_log in php.ini, then look for the error. If it's shared hosting and you don't have access to the ini file, ask the panel or support to enable the error log.
The Allowed memory size exhausted error is also usually "fixed" by raising memory_limit and comes back two weeks later. If a script needs 512 megabytes of memory, the problem is usually a loop or an unlimited query. Raise the value temporarily to get the site up, but find the cause that same day.
For this category of errors that don't have a clear message, documentation and the knowledge base usually answer faster than blind searching. If you're working on Linux hosting, logs and PHP settings are available from the same panel and you don't have to start from scratch.
Before opening a ticket, prepare these three things
Support can't do anything with "my site is broken." Write down the exact error code, the exact time it occurred (with time zone), and the last change you made before it. If you're opening a ticket, take choosing the ticket priority level seriously; a high-priority ticket for a minor issue both clogs the queue and makes genuinely urgent tickets get seen later.
And if the error is related to account login, read enabling two-factor login and recovering access before your account gets locked, not after.
Frequently asked questions
What's the difference between a 502 and a 503 error?
502 means the web server couldn't reach the backend; usually PHP-FPM is down or the socket is wrong. 503 means the service isn't responding, either intentionally or due to resource exhaustion. The first is a connection problem, the second is a capacity or maintenance mode problem.
Why does the site give a 502 error after a PHP update?
Because the Nginx configuration still points to the previous PHP-FPM version's socket. Align the fastcgi_pass path with the actual socket path of the new version and restart the service.
How do I fix the Too many connections error?
First use SHOW PROCESSLIST; to see how many connections are left in Sleep state. If the number is high, the code isn't closing connections on the error path. Raising max_connections without fixing the code only postpones the problem.
What does a white page with no error code mean?
It means a PHP error occurred but displaying and logging it are turned off. Enable error_log in php.ini and check the log; without it you have no clue.
One small habit helps more than any tool: every time you see an error, note the code, the time, and the last change in a file. After a month, you'll have your own personal error table that's more accurate for your environment than any documentation.