Quick answer
A 500 Internal Server Error means the server ran into an unexpected condition it did not handle, so it could not finish the request. The code is deliberately generic: the response hides the real reason, which the server writes to its error log in the same second. Usually an application failed, for example with a PHP fatal error or an uncaught exception; sometimes the web server itself is misconfigured. Visitors can only retry later; the fix starts with the error log.
01What does 500 Internal Server Error mean?
RFC 9110 defines 500 as the status a server sends when it "encountered an unexpected condition that prevented it from fulfilling the request". It is the catch-all of the 5xx family: the server knows it failed but has no more specific code for the failure, or chose not to reveal it.
That vagueness is intentional. Error details such as stack traces, file paths and database messages help attackers, so production servers show a short page and log the details instead. The useful information is therefore never in the browser; it is in the error log of whichever program generated the 500.
02Which 500 page do you see?
The page that comes with the 500 usually names the software that generated it, and that tells you which log to open.
| Page shows | Generated by | Read |
|---|---|---|
| 500 Internal Server Error, with nginx/1.x in the footer | nginx itself, not the application | /var/log/nginx/error.log |
| The server encountered an internal error or misconfiguration and was unable to complete your request. | Apache httpd, often an .htaccess problem | The Apache error log |
| There has been a critical error on this website. | WordPress 5.2 or later, after a PHP fatal error | The PHP error log, or wp-content/debug.log |
| This page isn't working ... HTTP ERROR 500 | Chrome, because the server sent a 500 with an empty body (typical for PHP with display_errors off) | The PHP-FPM or web server error log |
| Server Error (500) | Django with DEBUG off and no custom 500 template | Django's logging output |
| Internal Server Error, as plain text | Node.js with Express in production, Flask and other frameworks | The application's own log or journal |
03Which log lines explain a 500?
Open the error log and look at the lines written in the same second as the 500 in the access log. The table lists the lines that explain most 500s on typical Linux web servers.
| Log line contains | What it means | Usual fix |
|---|---|---|
| rewrite or internal redirection cycle while internally redirecting to "/index.html" | nginx: the try_files fallback does not exist either, so nginx loops until it gives up | Make sure the fallback file exists, or end try_files with =404 |
| rewrite or internal redirection cycle while processing | nginx: a rewrite rule keeps matching its own result | Add a condition or use break instead of last |
| PHP Fatal error: Allowed memory size of 134217728 bytes exhausted | PHP hit memory_limit (128M is the default) | Find what loads so much, or raise memory_limit for that site |
| PHP Fatal error: Uncaught Error | PHP code called something that does not exist, often after an update | Roll back the update, or fix the code it names |
| Invalid command '...', perhaps misspelled or defined by a module not included in the server configuration | Apache: an .htaccess directive needs a module that is not loaded | Enable the module, such as mod_rewrite, or remove the line |
| No space left on device | A full disk made writes fail | Free space with df -h and du; rotate logs |
[error] *1 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: , request: "GET /nothing HTTP/1.1"
[error] *2 rewrite or internal redirection cycle while processing "/loop/x", client: 127.0.0.1, server: , request: "GET /loop/x HTTP/1.1"
[crit] *5 stat() "/srv/www/html/index.html" failed (13: Permission denied), client: 127.0.0.1, server: , request: "GET /nothing HTTP/1.1"04Where to find the error log
Paths differ by distribution and setup. These are the defaults on Debian and Ubuntu; on Red Hat based systems Apache logs to /var/log/httpd/error_log instead.
# nginx
tail -f /var/log/nginx/error.log
# Apache httpd
tail -f /var/log/apache2/error.log
# PHP-FPM and other services managed by systemd
journalctl -u php8.2-fpm -f
# an application in Docker
docker logs --since 10m -f <container>
# is the disk full?
df -h05WordPress: "There has been a critical error on this website"
Since version 5.2, WordPress catches PHP fatal errors, shows this message with a 500 status and, if it can, emails the site administrator a link to recovery mode. A plugin or theme update is the usual cause. Recovery mode lets you log in with the faulty extension paused and deactivate it.
If the email does not arrive, turn on WordPress's own error log, reload the page once and read the last lines of wp-content/debug.log; they name the file and line that failed. Without admin access, rename the wp-content/plugins folder over SFTP to disable every plugin at once, then restore the name and re-enable plugins one by one. Switch debugging off again when you are done.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );06What can visitors do about a 500?
Very little, because the fault is on the server. Reload after a minute; many 500s are caused by a deployment or restart in progress. Do not resubmit a payment or an order form straight away, because the first attempt may have been processed before the error. If the error appears only for you, clear the cookies for that one site: a corrupted session can make an application fail for one visitor. If it persists, send the site owner the time, the address and what you were doing.
07Do 500 errors hurt SEO?
Briefly, no. Google documents that 5xx responses make its crawlers slow down, that content returned with a 5xx status is ignored, and that already indexed URLs are kept for a while but eventually dropped if the errors continue. A short incident costs little; a page that returns 500 for days can leave the index.
For planned maintenance, send a 503 with a Retry-After header instead of letting the site fail with 500s, and never serve error pages with a 200 status, which search engines treat as soft 404s.
Questions
Frequently asked questions
- 01Is a 500 Internal Server Error my fault?
- Almost never. A 500 means the server failed while handling an otherwise acceptable request, so the fix is on the server. The exception is a corrupted session: if only you see the error, clearing that site's cookies can help. Otherwise wait and retry, and tell the site owner if it persists.
- 02What is the difference between a 500 and a 502 error?
- A 500 is generated by the server that ran the failing code, such as the application or the web server itself. A 502 is generated by a proxy, CDN or load balancer that received no valid response from the server behind it. A proxy passes an application's 500 through unchanged, so the page and footer tell you which one you have.
- 03Why does Chrome show HTTP ERROR 500 on a blank page?
- Because the server sent a 500 status with an empty body, and Chrome replaces it with its own "This page isn't working" page. PHP does this on fatal errors when display_errors is off, which is the correct production setting. The reason is in the PHP or web server error log.
- 04Can a WAF or CDN cause a 500 error?
- Rarely by itself. A WAF that blocks a request normally answers 403, and a CDN usually passes the origin's 500 through or shows its own branded page. If a 500 appears only through the CDN, request the origin directly with curl --resolve and compare; differences point at headers or settings the proxy changes.
- 05How long does a 500 error last?
- Until its cause is fixed. Errors from a deployment or a restart often disappear within a minute. Errors from broken code, a full disk or a bad configuration stay until someone reads the log and fixes them.
Sources
Sources and verification
The configuration and commands on this page are examples, not a tested recipe. Adapt them to your system and check them before use (nginx -t for nginx, apachectl configtest for Apache).
- 01RFC 9110: HTTP Semantics, section 15.6.1 (500 Internal Server Error) · RFC Editor
- 02500 Internal Server Error · MDN
- 03Module ngx_http_core_module: try_files · nginx.org
- 04Apache HTTP Server: .htaccess files · Apache Software Foundation
- 05PHP core configuration: memory_limit · PHP
- 06PHP error handling configuration: display_errors, log_errors · PHP
- 07Debugging in WordPress · WordPress Developer Resources
- 08How HTTP status codes, and network and DNS errors affect Google Search · Google Search Central
Last updated