mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 17:35:52 +03:00
[GH-ISSUE #633] Unavailable host in proxy configuration preventing startup of NPM #535
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#535
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Elmardus on GitHub (Oct 5, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/633
Describe the bug
To Reproduce
NPM will now fail to start, with the following error log:
Operating System
@neojp commented on GitHub (Oct 21, 2020):
I've come across this before with the upstream nginx-proxy image. This is technically a non-solvable nginx problem (this is by design for performance purposes). The host + IP must exist otherwise nginx won't be able to bind it when its service starts.
@Elmardus commented on GitHub (Oct 21, 2020):
So if I understand correctly, the IP must be available on Nginx service startup?
As discussed in this stackoverflow answer, there is a way to circumvent this issue, but I'm not sure how to implement this in my NPM configuration.
@chaptergy commented on GitHub (May 12, 2021):
The "solution" is hard to implement in a generic way, since the DNS resolver can be a different ip on different hosts (at least the stack overflow answers all name different ips). It should be
127.0.0.11, if you use the custom docker network, but could be anything as soon as you use the bridge or host network. To see which resolver your instance uses, executecat /etc/resolv.confinside the container.NPM is served by the same nginx as the one that proxies your requests, hence both are unavailable if it refuses to start. As running multiple nginx instances is complicated, comes with lots of caveats and would require lots of code changes, I don't think this would be an option.
Since this is not really a bug, but instead an nginx "feature" and it could also be solved using the advanced configuration (which inserts code into the server block) or with a custom location with advanced code, I will close this issue.
For anyone coming here with this issue: Take a look at https://github.com/jc21/nginx-proxy-manager/issues/669#issuecomment-840054181 for the solution.
@kabadisha commented on GitHub (Mar 12, 2023):
Firstly, thanks @chaptergy for the tip to that other thread with a workaround. Much obliged.
I found that to solve the problem, I didn't actually have to include specifying the resolver. This worked for me:
This made me wonder about what you said here:
If the resolver doesn't have to be explicitly defined, couldn't NPM generate the config as per my example, inserting the Forward Hostname using a variable and thus avoid this issue where Nginx won't start if that host is unavailable?
Many thanks :-)
EDIT:
After doing some more digging, this actually explains why we only see the startup failure when an unavailable host is added as a 'Custom Location' in the GUI. When NPM generates the config for the top level, the hostname is inserted using the
$servervariable, thus avoiding the issue.However, for custom locations the host entered in the GUI is simply transposed directly into the proxy_pass directive like this:
proxy_pass http://example.com;