What does HTTP 500 mean?
The server hit an unexpected condition and could not complete the request. The generic “something broke” error. It is never the client’s fault; the details are in the server’s error log, not in the response.
5xx Server error: The request looked valid, but the server failed to fulfil it. The fix is on the server side.
Common causes of a 500 error
- An unhandled exception in application code.
- Syntax error in
.htaccessor a misconfigured server module. - Database connection failures.
- Wrong file permissions on scripts (e.g. PHP files with execute-only or overly open permissions under suEXEC).
How to fix 500 Internal Server Error
- Check the application and web server error logs.
- Roll back the latest deployment or configuration change.
- Validate
.htaccessand server configs after editing.
How to find the cause of a 500
A 500 is a crash on your server, so the error log has the real reason. The browser never shows it.
sudo tail -n 50 /var/log/nginx/error.log
sudo tail -n 50 /var/log/apache2/error.log
sudo journalctl -u your-app -n 50 --no-pagerLook for the first error near the time of the failed request. On WordPress, temporarily set WP_DEBUG_LOG to true in wp-config.php, and check whether a recent plugin update caused it. Also check whether the disk is full with df -h.
500 and SEO
Short outages are tolerated, but persistent 500s cause Google to crawl less and eventually drop the pages. Monitor for them.
Example response
HTTP/1.1 500 Internal Server Error
How to return a 500 response
Node.js (Express)
res.status(500).json({ error: 'Internal Server Error' });PHP
http_response_code(500);Python (Flask)
return {'error': 'Internal Server Error'}, 500Go (net/http)
w.WriteHeader(500)nginx
return 500;
Related status codes
- 502 Bad Gateway — A gateway or proxy got an invalid response from the upstream server.
- 503 Service Unavailable — The server is temporarily unable to handle the request.
- 504 Gateway Timeout — A gateway or proxy did not get a response from the upstream server in time.
- 501 Not Implemented — The server does not support the functionality required to fulfil the request.
Check which status code a URL returns with the HTTP header checker.