mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 09:25:55 +03:00
[GH-ISSUE #681] Running NPM and PiHole at the same time #576
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#576
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 @wschlotter on GitHub (Oct 30, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/681
I am wondering what the solution would be to run both NPM and PiHole on the same computer? They both say to use port 80 and 443.
@aronwk-aaron commented on GitHub (Nov 1, 2020):
If you are using docker, you can just change the mapped ports on one (or in my case, both) of the containers
@wschlotter commented on GitHub (Nov 2, 2020):
I understand that, but both say that is ill advised. I did have NPM running on a different port bu them me Lets Encrypt did renew the certificates.
@jlnwlf commented on GitHub (Nov 3, 2020):
I came up with changing the port used by
lighttpdfor pi-hole (not in a container) from80to8017and made a proxy host entry in NPM to point to the lighttpd server on port8017.Depending on your requirements/network/use case, that might not be enough though...
@rastacalavera commented on GitHub (Nov 23, 2020):
I am in this situation. I want to run pihole rather than adguard home. I run all my docker containers on a pi4 and want to include pihole in this setup. I can get pihole running using this compose file
But when I have my router DHCP server use the pi address of 192.168.0.140 nothing on my network can resolve and it doesn't look like any traffic is moving through pi hole. I don't want to be able to access it remotely, I just want it to play nice with npm on my machine. Seems like it should be an easy thing to address, I just am not super experienced. Most of this compose file was taken from the pihole documentation, but I also added in some environment variables I saw on an other compose-file that used a reverse proxy.
@crazybadger commented on GitHub (Nov 23, 2020):
I'm not convinced running them on the same machine is sensible, given one is trying to route external requests and the other is trying to block some internal ones. They work well on the same network given then own IP stack though!
@rastacalavera commented on GitHub (Nov 23, 2020):
Yeah I have used them separately before, it is just a nice attraction to consolidate onto a single machine. I dedicated my other pi to home assistant, and they have adguard as an extension but i prefer pihole.
@crazybadger commented on GitHub (Nov 23, 2020):
You could run NPM as a Home Assistant Add On and then use your other Pi for Pi-Hole? I have NPM running on a Hass.io Pi and Pi-hole running on a FreeNAS VM.
@jc21 commented on GitHub (Nov 23, 2020):
Wait hang on, I don't use pi-hole but from what I've read in their documentation it's just a DNS sinkhole with an optional VPN. As a DNS sinkhole, NPM does not conflict as it doesn't run a DNS server. There should not be an issue running them on the same machine. Pi-hole's web interface can run on any port, npm can proxy to it. Pi-hole's DNS server can run on the standard port 53 and NPM won't care.
Unless I'm missing something here?
In addition to running these together on the same machine: if you utilize docker networks and don't map pi-hole's ports to the docker host, you won't need to change ports and instead add a stream to forward 53 to pi-hole as well:
Then add a proxy host for pi-hole with hostname
piholeon either80or443, then add a stream topiholeon port53udp/tcp. These services will be contained in the same virtual network namedskynetand the only service being exposed directly is NPM. This is how I run all my services but once again I haven't tested this with pi-hole myself.@rastacalavera commented on GitHub (Nov 24, 2020):
Really appreciate the reply!
I decided to try everything on a fresh install of Ubuntu 20.04 on a raspberryPi 4.
There are some new errors that are cropping up.
Here are the errors I am seeing:
When I run sudo lsof -i :53 to see what is on port 53 here is the output:
This is my SECOND time attempting this, the first time I followed the directions here on how to get systemd-resolve to get off that port but then all of my apt commands were broken and I couldn't fix them and had to do a clean install again.
Here is the compose file
@rastacalavera commented on GitHub (Nov 24, 2020):
Ok i think I am getting closer. I made some changes to the Docker-Compose file and that will be included last.
Now I have access to the NPM and PiHole Web GUIs but I am not confident that I am setting up the host or stream in NPM. Here are some images to show the setup.
I have never done a stream before. . .
Here is my new compose file. I had to change the DB (issue on this for RPi) and added in some environmental variables for PiHole. I did see way down in the documentation of PiHole that they say how to solve the port 53 issue on Ubuntu so shame on me for not reading everything :P I don't know if I needed the ports in PiHole but I couldn't get the the GUI without them.
@rastacalavera commented on GitHub (Nov 24, 2020):
God how did I over look this? Thanks for that. If I can't get this issue figured out, that is the route I will take. I am just so far down the rabbit hole now I can't abandon ship until all my hair has been pulled out.
@rastacalavera commented on GitHub (Nov 25, 2020):
So I spent most of the day playing with this and couldn't get it functional. I ended up finding a pi zero w that i forgot I had and put pihole on that. Love NPM, keep up the great work jc21!
@johntdavis84 commented on GitHub (Dec 14, 2020):
I'm presently struggling with this as well. I'm trying to install NGINX Proxy Manager on top of docker on a Raspberry Pi 4B.
@jc21 , I just tracked this down a few minutes ago, because I couldn't figure out why pi-hole needed 443, either. Apparently, according to the pi-hole GitHub, certain ads are served via SSL, so it needs that port. (Though I can't figure out how to see just t hose in the pi-hole admin.)
My situation is complicated because I'm running pi-hole in privileged mode, due to a specific bug in Manjaro Linux that makes lighttpd crash and burn inside the container unless it is in privileged mode.
Getting a second Pi just to run pi-hole is not a terrible idea, but it's not an option budget- and space-wise at this time. (it also seems wasteful, honestly, given how little this server is currently doing.)
Any suggestions? I have a vague understanding I could set up a macvlan ... thing? ... to create a separate virtual LAN IP range for the pi-hole, but ugh. I really don't want to have to go down that rabbit hole right now.
I'm wondering if I could just get a USB gigE adapter, plug that in, and set up a separate network just for the pi-hole?
@nimjor commented on GitHub (Jan 2, 2021):
I agree with @jc21, I was able to get this working without doing much of anything special. I am running NPM and Pi-hole inside separate docker containers in the same ubuntu vm. I didn't need to set up a docker network or anything like that. My steps:
Create docker-compose.yml file for the Pi-hole, mapping container ports 53 and 67 to the same ports on the vm, and container 80 and 443 to the vm's 8082 and 8443 (since NPM's container is already using 80 and 443 of the vm).
I did also have to follow the steps here for modifying Ubuntu's systemd-resolved service since that was already listening on 53.
docker-compose up -d
At first I hadn't thought it through properly and so I initially set it up with the Pi-hole listening on 8053, and then I had a stream set up in NPM to direct incoming traffic on 53 to 8053, but that didn't work for me. I later realized there was no point to that; nothing else on my machine was listening on 53, so I adjusted my yml file to do that and it just started working (no need for a stream).
@anselal commented on GitHub (Jan 4, 2021):
@wschlotter just change the port for the PiHole web gui. it doesn't affect pihole.
you can run the following commands to change the port to 8080:
@wschlotter commented on GitHub (Jan 4, 2021):
Forgot about this thread (setup a new machine for something else and installed instead) but this will be helpful in the future when I merge some other dockers to the same machines!
@johntdavis84 commented on GitHub (Jan 7, 2021):
Thanks for this info. I’m working on getting this set up now.
One thing that makes me hesitate a bit is this bit from the pihole/pihole docs: https://hub.docker.com/r/pihole/pihole
“Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used, then blocked HTTPS queries will fail to connect to port 443 and may cause long loading times. Rejecting 443 on your firewall can also serve this same purpose. Ubuntu firewall example: sudo ufw reject https"
If we forward port 443 from inside the container to port 80443 outside the container, does it break the blocking of SSL ads?
@anselal commented on GitHub (Jan 7, 2021):
@johntdavis84 from what you say, YES it will break the blocking of SSL ads. But this question is related to PiHole and not this repo. But a clearer answer please refer to PiHole.
@johntdavis84 commented on GitHub (Jan 7, 2021):
Thanks, Anastasios. I commented on this thread as I do consider getting NGINX Proxy Manager working with Pi-Hole to be on-topic for this thread. I wanted to clarify, since the first impression I got from reading this was that pihole was fully working with this configuration, but then I thought about it and realized doing it this way partially breaks Pi-Hole’s functionality.
This is definitely entirely a PiHole problem—and a DNS problem—and not an NGINX problem. Blocking SSL-enabled ads essentially requires making sure Pi-Hole has its own WAN-facing IP address on the host server, which is frankly ridiculous. I can do it, but it’s overcomplicated and degrades my network performance—at least if I want to keep IPv6 enabled.
@anselal commented on GitHub (Jan 8, 2021):
@johntdavis84 also, when they mention port 443 I think they mean fro outgoing connection and not incoming, so you won't have a problem installing
nginx-proxy-managerandpiholeon the same machine.@johntdavis84 commented on GitHub (Jan 8, 2021):
Good morning,
I can’t bring up pi-hole when NGINX Proxy Manager is running. I get an error that the container cannot bind to port 443. So, yes, Pi-Hole wants to listen on port 443—or otherwise seize it and not share it.
@BartAgterbosch commented on GitHub (May 29, 2022):
Oh man...! If only I had found your comment sooner...
Simply disabling DNSStubListener in resolved.conf did the trick, I've wasted so much time trying to figure out what or why something was conflicting on port 53 thinking it must've been npm somehow, I don't even know why I thought that, yet this could've saved me such headaches.
This should be stickied on the pihole docker page imo
Fyi: To anyone doing this, you can just edit /etc/systemd/resolved.conf and uncomment DNSStubListener, and change "yes" to "no", save the file, reboot the system, and start the pihole container listening on 53 udp and tcp, and just change the http port to something like 8989:80 or whatever, pihole only seems to need it for admin panel access, and just leave npm as is, listening on port 80 and 443
@idc77 commented on GitHub (Jan 28, 2025):
Seems like npm isn't able to forward ports <1024, despite having capabilities set or npm having privileged:true and/or capabilities set.
@theannihilator commented on GitHub (Aug 26, 2025):
I setup a docker container for npm and pi-hole with pi-hole webui running 88:81 and 445:443 because im a bit lazy i have dns setup to pihole. NPM is able to route all my websites properly with current setup.