Nginx: nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:5
Nginx couldn't resolve the hostname in an upstream/proxy_pass at startup.
nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:5[emerg] host not found in upstreamhost not found in upstream "backend:3000"nginx: [emerg] host not found in resolvercould not be resolved (3: Host not found) nginx Meaning
Nginx resolves upstream names when it loads the config. In Docker Compose the service must exist and be on the same network and started; if the backend isn't up yet nginx exits. Use resolver 127.0.0.11; with a variable in proxy_pass for lazy resolution, or depends_on + restart policy.
Common causes
- Backend container not started/not on the same network
- Typo in the host name
- DNS not available at nginx startup
- Static resolution at load time
- Kubernetes service not created
⚡ Quick fix
- Start the backend first (
depends_on) and verify the service name - Use lazy resolution:
resolver 127.0.0.11 valid=10s; set $up http://app:3000; proxy_pass $up; - Check
docker network inspect
Detailed fix by platform
Docker
docker compose exec nginx getent hosts app
How to diagnose
- Name — Spelled right?
- Network — Same?
- Resolution — At startup?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026