Interview Prep/Networking/Load balancers and reverse proxies

nginx refuses to start: `nginx: [emerg] host not found in upstream "backend:8080" in /etc/nginx/conf.d/app.conf:5`.

BeginnerTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → nginx resolves upstream hostnames at startup and fails if any don't resolve. In Docker Compose/Kubernetes this happens when nginx starts before the backend container/service exists, or the name is wrong (wrong network, wrong namespace).

Diagnose →

docker compose exec nginx getent hosts backend
docker network inspect <network> | grep -A3 backend
nginx -t

Fix → Put both containers on the same network and use the correct service name, add depends_on with a healthcheck condition, or use a variable with resolver 127.0.0.11 valid=10s; (Docker's embedded DNS) so resolution happens per request instead of at startup.

Prevent → Run nginx -t in CI against the target environment's names, and avoid hard startup dependencies between containers.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies