Introduction
A 502 Bad Gateway error happens when a server acting as a gateway or proxy gets an invalid response from the upstream server. This error stops users from accessing the website or service. Troubleshooting helps find and fix the cause quickly.
When your website shows a 502 error instead of loading normally
When your Nginx server is set up as a reverse proxy but the backend app is not responding
When you recently changed backend server settings and users report connection problems
When you want to check if your backend service is running and reachable
When you want to verify Nginx configuration for proxying requests