Skip to content

Nginx errors 502, 504, 403 and 500 – what they mean and how to fix them

What the 502 Bad Gateway, 504 Gateway Time-out, 403 Forbidden and 500 Internal Server Error errors mean on a server with Nginx and how to fix them. The chain from the browser to the application, diagnostics with curl, the error.log journal and systemctl, a breakdown of common causes with real log lines, and how to set timeouts and access rights. Tested on Debian 12 with Nginx 1.22.1 and PHP 8.2.