Option to select a web port number at install time

It would be very convenient to be able to specify a port number for the Pi-Hole web interface at install time. I need to save port 80 for a conventional web server.

We recently were talking about this as a team. What are your thoughts on a Pi-hole webserver binary that would be on a predefined port for just the Admin page? With the coming release of 4.0 and NXDOMAIN or null routing responses the issues with not having a blockpage may be not as predominant. Perhaps port 314 for the admin page?

3141 would be outside of the restricted port range.

1 Like

While there may be other factors, of which I am not aware, to consider, my desire is simply to avoid a conflict with port 80. As such I would like to be able to select the Pi-hole webserver port myself. My tendency would be to select a high port number, >8000 perhaps.

The concerns with allowing the choice of ports for the interfaces is that we are a project that many times is the first exposure to linux a user has. While the advanced users may know that high numbered ports are available for daemons to run without needing elevated privileges, explaining that to a new operator is sometimes problematic. And without knowing the port selected it's difficult to troubleshoot remotely. With a known, high numbered port, we can facilitate troubleshooting by asking users if they are using the address http://pi.hole:3141 and remove a lot of the ambiguity in those steps. Otherwise I have concerns that we are going to end up asking for the port number for the admin page and be met with responses like "I don't remember" or "I don't know, I just hit enter on all the dialogs." It's something that we could easily detect with the debugger, but getting those tokens on the initial help request is also sometimes problematic.

I could see a setup with a dialog asking for the port with a set default already, and if the user wanted to override that, then they could chose their own.

Perhaps show a default of 80 and with a note that choosing an alternative is for experienced users only. That might do it! And of course if an alternate port is selected it should be maintained thru an update.

I can understand you may not want to complicate the install. As an alternative how about a "pihole" command to enter at the terminal prompt to accomplish this. As such only those of us who read the documentation will be making the change and the casual user will not be confused.

Both great suggestions. It's going to be a few releases before we are in the position to implement it. There are a lot of benefits to moving to our own http server and freeing us from needing a privileged port assignment. The decisions to be made are about including our own server versus just allowing the user to bring their own and pick the port. I've got this on the board for implementation but it's going to take some time and some changes to the code to allow for it.

Thanks for your consideration! I am a happy user and will be making a contribution to the cause.


Why not use nginx as an optional proxy? Many projects bind to a non-priviliged port with a their own HTTP stack while leveraging the reverse proxies to serve via port 80/443 if people need it. I don't see why a LAN-only software needs to use the default HTTP(S) ports.

Optional ports will come with the API and new web interface.

1 Like

That feature would be a must. Even if needing a bit of digging in the documentation to find it.

I'd advocate the use of a command AFTER the install in case you notice you want to run a webserver on your Pi later

Just for your info: