[GH-ISSUE #3295] Webinterface fails to start when stream host is unavailable. #2222

Open
opened 2026-02-26 07:34:34 +03:00 by kerem · 14 comments
Owner

Originally created by @david-d-white on GitHub (Oct 30, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3295

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

Configuring stream hosts on NPM by hostname prevents startup while repeatedly reporting: host not found in upstream "<hostname>".

Nginx Proxy Manager Version

v2.10.4

To Reproduce
Steps to reproduce the behavior:

  1. Add a stream host to nginx proxy manager. Refer to the stream host by container name.
  2. Start nginx proxy manager when the stream host is down.
  3. NPM fails to start, and web interface is unreachable.

Expected behavior

NPM management interface should still be reachable when a stream host is unavailable. Currently the container files need to be edited/removed manually if there is a typo in the hostname, or otherwise a host must be made available with that name for NPM to start.

Additional context

NPM repeatedly reports the following log messages while failing to start:

" nginx-proxy-manager  | ❯ Starting nginx ...
nginx-proxy-manager  | nginx: [emerg] host not found in upstream "<hostname>" in /data/nginx/stream/x.conf:11"

The problem seems similar to issue https://github.com/NginxProxyManager/nginx-proxy-manager/issues/633

server {
  listen 2200;
listen [::]:2200;


  proxy_pass <hostname>:<port>;

  # Custom
  include /data/nginx/custom/server_stream[.]conf;
  include /data/nginx/custom/server_stream_tcp[.]conf;
}

The generated nginx config file seems to follow the format above. It looks like the hostname is used directly in the proxy_pass directive which causes nginx to fail when it can't find the host. I imagine changing the behaviour to first store the hostname in a variable and use that veriable in the proxy_pass directive would circumvent this issue like it does in the generated configs for for the proxy hosts.

If possible it would also be good if the NPM would first serve it's own web interface first before attempting to serve any of the configured hosts, to prevent issues like this from requiring command line intervention, or diving into the dockerfiles of the NPM container. I'm not sure how feasible this would be though since I have not looked at the code at all.

Originally created by @david-d-white on GitHub (Oct 30, 2023). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3295 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> Configuring stream hosts on NPM by hostname prevents startup while repeatedly reporting: `host not found in upstream "<hostname>"`. **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> v2.10.4 **To Reproduce** Steps to reproduce the behavior: 1. Add a stream host to nginx proxy manager. Refer to the stream host by container name. 2. Start nginx proxy manager when the stream host is down. 3. NPM fails to start, and web interface is unreachable. **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> NPM management interface should still be reachable when a stream host is unavailable. Currently the container files need to be edited/removed manually if there is a typo in the hostname, or otherwise a host must be made available with that name for NPM to start. **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. --> NPM repeatedly reports the following log messages while failing to start: ``` " nginx-proxy-manager | ❯ Starting nginx ... nginx-proxy-manager | nginx: [emerg] host not found in upstream "<hostname>" in /data/nginx/stream/x.conf:11" ``` The problem seems similar to issue https://github.com/NginxProxyManager/nginx-proxy-manager/issues/633 ``` server { listen 2200; listen [::]:2200; proxy_pass <hostname>:<port>; # Custom include /data/nginx/custom/server_stream[.]conf; include /data/nginx/custom/server_stream_tcp[.]conf; } ``` The generated nginx config file seems to follow the format above. It looks like the hostname is used directly in the proxy_pass directive which causes nginx to fail when it can't find the host. I imagine changing the behaviour to first store the hostname in a variable and use that veriable in the proxy_pass directive would circumvent this issue like it does in the generated configs for for the proxy hosts. If possible it would also be good if the NPM would first serve it's own web interface first before attempting to serve any of the configured hosts, to prevent issues like this from requiring command line intervention, or diving into the dockerfiles of the NPM container. I'm not sure how feasible this would be though since I have not looked at the code at all.
Author
Owner

@gigaion commented on GitHub (Nov 19, 2023):

Ran across this also. Glad to see an issue is already open for it.

<!-- gh-comment-id:1817957285 --> @gigaion commented on GitHub (Nov 19, 2023): Ran across this also. Glad to see an issue is already open for it.
Author
Owner

@guilhermeluciano3 commented on GitHub (Dec 11, 2023):

+1

<!-- gh-comment-id:1850675631 --> @guilhermeluciano3 commented on GitHub (Dec 11, 2023): +1
Author
Owner

@github-actions[bot] commented on GitHub (Jul 18, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2235120838 --> @github-actions[bot] commented on GitHub (Jul 18, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@nfriedly commented on GitHub (Jul 18, 2024):

👍

<!-- gh-comment-id:2235248420 --> @nfriedly commented on GitHub (Jul 18, 2024): :+1:
Author
Owner

@danierukun commented on GitHub (Nov 29, 2024):

👍

<!-- gh-comment-id:2507132398 --> @danierukun commented on GitHub (Nov 29, 2024): :+1:
Author
Owner

@gavinc commented on GitHub (Dec 23, 2024):

#3970 is the same issue (and, I favor, this IS an issue. If you enjoy making docker services come and go at whim, NPM now has you on a leash. Better tell NPM before you shut down that service for a bit.)

<!-- gh-comment-id:2559475670 --> @gavinc commented on GitHub (Dec 23, 2024): #3970 is the same issue (and, I favor, this *IS* an issue. If you enjoy making docker services come and go at whim, NPM now has you on a leash. Better tell NPM before you shut down that service for a bit.)
Author
Owner

@Dominic-Preap commented on GitHub (Dec 30, 2024):

This is a huge issue for us, as we are using Portainer to stop the container, reboot the server just to add more HDD space. After it restarts, we can't go to Portainer to start the container as NPM is stuck on an error upstream of that container. And now every containers we're hosting are all down.

<!-- gh-comment-id:2565063766 --> @Dominic-Preap commented on GitHub (Dec 30, 2024): This is a huge issue for us, as we are using Portainer to stop the container, reboot the server just to add more HDD space. After it restarts, we can't go to Portainer to start the container as NPM is stuck on an error upstream of that container. And now every containers we're hosting are all down.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 10, 2025):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:3055040424 --> @github-actions[bot] commented on GitHub (Jul 10, 2025): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@Dominic-Preap commented on GitHub (Jul 10, 2025):

There you go

<!-- gh-comment-id:3055055383 --> @Dominic-Preap commented on GitHub (Jul 10, 2025): There you go
Author
Owner

@nfriedly commented on GitHub (Jul 10, 2025):

👍

<!-- gh-comment-id:3057030581 --> @nfriedly commented on GitHub (Jul 10, 2025): :+1:
Author
Owner

@fireinice commented on GitHub (Aug 18, 2025):

why we just unlink the failed conf and show some alert on ui? since we can get the failed conf from nginx -t.

<!-- gh-comment-id:3196245891 --> @fireinice commented on GitHub (Aug 18, 2025): why we just unlink the failed conf and show some alert on ui? since we can get the failed conf from nginx -t.
Author
Owner

@tkodev commented on GitHub (Jan 27, 2026):

still having this issue

<!-- gh-comment-id:3803714720 --> @tkodev commented on GitHub (Jan 27, 2026): still having this issue
Author
Owner

@Naeaeaeaeae commented on GitHub (Feb 2, 2026):

why we just unlink the failed conf and show some alert on ui? since we can get the failed conf from nginx -t.

Had the same Problem with 'host not found in upstream' -
YES please, just unlink/rename

  1. Idea: one time Popup at login (not sure if possible with given Methods)
  2. Idea: rename file & DB entry to [].conf -> [].conf_failed and show an warning-icon in the UI, ...
<!-- gh-comment-id:3834153542 --> @Naeaeaeaeae commented on GitHub (Feb 2, 2026): > why we just unlink the failed conf and show some alert on ui? since we can get the failed conf from nginx -t. Had the same Problem with 'host not found in upstream' - YES please, just unlink/rename 1. Idea: one time Popup at login (not sure if possible with given Methods) 2. Idea: rename file & DB entry to [].conf -> [].conf_failed and show an warning-icon in the UI, ...
Author
Owner

@mafuyuuu1 commented on GitHub (Feb 9, 2026):

This problem only occurs when the Nginx test (nginx -t) fails and the server is restarted or disconnected before the issue is fixed. My current 'band-aid' solution is way too much work.

<!-- gh-comment-id:3870031917 --> @mafuyuuu1 commented on GitHub (Feb 9, 2026): This problem only occurs when the Nginx test (nginx -t) fails and the server is restarted or disconnected before the issue is fixed. My current 'band-aid' solution is way too much work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#2222
No description provided.