Linux Server / Networking, SSH & Web Services
Separate an NGINX 502 from a failing backend
A proxy can be healthy while its upstream is down, misaddressed or using a different protocol. Test the intended local backend without client credentials.
Environment and inputs: Linux server baseline · Ubuntu 24.04 LTS / RHEL 9-style systems. Use the specified distribution, init system and installed tool; service names, privileges and supported options can differ.
Start with this check
Check the computer, command shell and account permissions. Replace example names, file paths, domains and interfaces with approved values. These commands help investigate the problem. Before making changes, check the rules and the effect on running applications.
curl --connect-timeout 3 --max-time 10 -I http://127.0.0.1:8080/health
What the results mean
The example performs a bounded HEAD request against an illustrative backend. HEAD may be unsupported and a localhost test does not reproduce every proxy header or namespace.
Fix the cause and check again
Compare NGINX's exact upstream error with the backend listener, health contract and service logs. Repair the demonstrated dependency and retest through the proxy.
Before changing production
Do not expose the backend publicly or disable TLS checks to make a 502 disappear.