Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

HTTP 500 Internal Server Error

The server hit an unexpected condition and could not complete the request.

Atualizado em

500
Internal Server Error
5xx Server error
Class
RFC 9110 §15.6.1
Defined in

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 .htaccess or 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 .htaccess and 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-pager

Look 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'}, 500

Go (net/http)

w.WriteHeader(500)

nginx

return 500;

Related status codes

Check which status code a URL returns with the HTTP header checker.

All HTTP status codesSearch the full list of status codes from 100 to 599 with their meanings and SEO impact.
Open the full list

Perguntas frequentes

What does status code 500 mean?
500 Internal Server Error: The server hit an unexpected condition and could not complete the request.
How do I fix a 500 error?
Check the application and web server error logs. Roll back the latest deployment or configuration change.
Does 500 affect SEO?
Short outages are tolerated, but persistent 500s cause Google to crawl less and eventually drop the pages. Monitor for them.