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
Confirm the host, shell and access role. Replace sample names, paths, domains and interfaces with approved targets. These are diagnostic commands; assess policy and workload impact before making changes.
curl --connect-timeout 3 --max-time 10 -I http://127.0.0.1:8080/health
Read the result
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.
Resolve and verify
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.