NGINX is used all kind of reverse proxy uses from Keycloak to Oracle APEX Reverse Proxy Management for self-hosting and the Autonomous DB.
I’ve had this problem couple of times now. It occurred when I took a container offline, and NPM wouldn’t start at all. I should’ve written this down the first time this happened… although here is a fix.
To get more information, request the logs
docker logs nginx-proxy-manager
Here you can see an upstream issue at line 54 of /data/nginx/proxy_host/2.conf
❯ Starting nginx ...
nginx: [emerg] host not found in upstream "opc-keycloak-1" in /data/nginx/proxy_host/2.conf:54
[12/19/2024] [1:30:06 PM] [Migrate ] › ℹ info Current database version: none
[12/19/2024] [1:30:06 PM] [Setup ] › ℹ info Logrotate Timer initialized
[12/19/2024] [1:30:06 PM] [Setup ] › ℹ info Logrotate completed.
[12/19/2024] [1:30:06 PM] [IP Ranges] › ℹ info Fetching IP Ranges from online services...
[12/19/2024] [1:30:06 PM] [IP Ranges] › ℹ info Fetching https://ip-ranges.amazonaws.com/ip-ranges.json
[12/19/2024] [1:30:06 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v4
[12/19/2024] [1:30:06 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v6
[12/19/2024] [1:30:06 PM] [SSL ] › ℹ info Let's Encrypt Renewal Timer initialized
[12/19/2024] [1:30:06 PM] [SSL ] › ℹ info Renewing SSL certs close to expiry...
[12/19/2024] [1:30:06 PM] [IP Ranges] › ℹ info IP Ranges Renewal Timer initialized
[12/19/2024] [1:30:06 PM] [Global ] › ℹ info Backend PID 170 listening on port 3000 ...
❯ Starting nginx ...
nginx: [emerg] host not found in upstream "opc-keycloak-1" in /data/nginx/proxy_host/2.conf:54
❯ Starting nginx ...
nginx: [emerg] host not found in upstream "opc-keycloak-1" in /data/nginx/proxy_host/2.conf:54
❯ Starting nginx ...
nginx: [emerg] host not found in upstream "opc-keycloak-1" in /data/nginx/proxy_host/2.conf:54
❯ Starting nginx ...
nginx: [emerg] host not found in upstream "opc-keycloak-1" in /data/nginx/proxy_host/2.conf:54
To workaround this temporarily, the fix is… enter bash
docker exec -it nginx-proxy-manager /bin/bash
Install nano
apt update
apt install nano
Edit the offending file
nano /data/nginx/proxy_host/2.conf
Around line 54, change
proxy_pass http://opc-keycloak-1:8080;
to
proxy_pass http://localhost:8080;
Reload nginx
nginx -s reload
Back in the game!
Once the UI is open, you can correct the hostname in the UI
ENJOY
What’s the picture? - A Fruit Tea Loaf from The Secret Bakery. Visit Yorkshire!