r/nginxproxymanager • • 19d ago

Nginx-proxy-manager stops working when a docker container stops

Whenever a docker container stops or exits, the Nginx stops working, non of my hosts work. Is there a way around this or is it a limitation where the proxy is trying to resolve a host that's not reachable.

0 Upvotes

9 comments sorted by

3

u/evanmac42 19d ago

Your suspicion about hostname resolution might actually be correct.
If NPM uses Docker container names as upstream hosts, stopping one of those containers could cause an Nginx configuration reload to fail with something like host not found in upstream.
But stopping a backend shouldn’t automatically take down every other proxy host.
I’d check two things immediately after reproducing the problem:
Run nginx -t inside the NPM container.
Check the NPM/Nginx error logs for host not found in upstream or configuration reload failures.
If that’s the cause, you can focus on how Nginx resolves your Docker upstreams instead of rebuilding everything.

1

u/mwolfaardt 19d ago

I use the container name, and the logs tells me, and I can't access any other host.

nginx: [emerg] host not found in upstream "editorTemplate-api" in /data/nginx/proxy_host/13.conf:76

1

u/evanmac42 19d ago

If you want more control over how Nginx handles Docker upstreams, you could simply drop NPM and configure Nginx directly.
That’s what I do. No GUI, just Nginx configuration files, and full control over its behaviour.

1

u/mwolfaardt 18d ago

Thank you, yeah I'll have a look, AI helps with the config,it's just the cert renewal that I don't know what to do

4

u/dadarkgtprince 19d ago

Sounds like you have something set up wrong

1

u/BleeBlonks 19d ago

Yep

1

u/mwolfaardt 19d ago

nginx: [emerg] host not found in upstream "editorTemplate-api" in /data/nginx/proxy_host/13.conf:76

1

u/jimjim975 19d ago

DNS my brotha.

1

u/mwolfaardt 18d ago

My adguard home point the domain to nginx proxy manager