I suspect this isn't possible for various reasons and what I've read but I have to ask... is it possible to alter pi-hole's default ports? I'm trying to build a machine (RPi 5, 8Gb with 64Gb MicroSD, 2 x 2Tb SSD) with multiple installs on it and I had conflicts when I installed Apache (part of my Nextcloud install).
Perhaps I need to alter Apache's default port or, another option I read about, migrate Pi-Hole to Apache from lighttpd?
I don't have the greatest level of Linux experience but, FWIW, I really don't like Docker/Portainer so, while a solution, it's one I'd rather avoid.
If v5, you can modify the port lighttpd is using via the ‘server.port’ configuration setting in /etc/lighttpd/lighttpd.conf.
I found this information via a search, and have not verified it myself. If you change the port, you will need to restart the lighttpd service for the change to take effect.
I know it can also be changed on v6, but not through lighttpd, as v6 does not use lighttpd.
If you will build a new machine with Pi-hole, you will install the current version: Pi-hole v6.
Pi-hole v6 doesn't use lighttpd. It has its own embedded web server.
You can change Pi-hole v6 web ports using this command:
# example using the default ports
sudo pihole-FTL -- config webserver.port '80,443s'
# example using alternative ports and "optional" flag
sudo pihole-FTL -- config webserver.port '8080o,8443os'
Notes:
add the o flag to make a port optional (the web server will start even if the port is in use by other service).
Tried that but I couldn't make it work, even edited what appeared to be a relevant section in the pihole.toml file, under "webserver" as I recall:
Changing it from port = "80o,443os,[::]:80o,[::]:443os" to port = "8080o,8443os[::]:8080o,[::]:8443os" commenting out the original line... it didn't make much (if any) difference but when I checked the file I found this: port = "8080o,8443os[::]:8080o,[::]:8443os" ### CHANGED, default = "80o,443os,[::]:80o,[::]:443os" and NO commented out line.
Very weird!
Even more weird, despite no success with any of the above, both services are now running simultaneously:
After any changes to the config file, Pi-hole v6 will read the file and read the changes. Then it will rewrite the file using the original format (every commented line will be removed and # CHANGED, default = ... will be added to all settings not using the default value).
Your image shows Apache and Pi-hole FTL service (this is the DNS service) running, but there is no way to know if the Pi-hole web server is running.
Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal: