Guys, may I ask how the port could be changed on Pi-Hole V6 (development-v6)?
Looks that image based on Alpine is not using the lighttpd web server.
I moved your question to a new topic in the right category (Beta 6.0
).
That other topic was about a Pi-hole v5 issue. Pi-hole v5 uses lighttpd
.
On the other hand, Pi-hole v6 has it's own internal web server and doesn't use lighttpd
at all.
It wasn't clear if you want help for a docker installation or if you just used the alpine image as a reference, so here are the places where you can find help for v6:
-
If you just need docker instructions for Pi-hole v6, this is the README file for v6 (still in development).
Note: if you are using docker, you don't need to change the port inside the container.
Just use the docker-p
option to publish the desired port.
Example:-p 8080:80
will publish the container port80
on the host port8080
. -
If you installed Pi-hole directly on the Operating System and want to change the port, you can change the port in
/etc/pihole/pihole.toml
. Find the[webserver]
section and change theport
.This is what you will see:
# Ports to be used by the webserver. # Comma-separated list of ports to listen on. It is possible to specify an IP address # to bind to. In this case, an IP address and a colon must be prepended to the port # number. For example, to bind to the loopback interface on port 80 (IPv4) and to all # interfaces port 8080 (IPv4), use "127.0.0.1:80,8080". "[::]:80" can be used to # listen to IPv6 connections to port 80. IPv6 addresses of network interfaces can be # specified as well, e.g. "[::1]:80" for the IPv6 loopback interface. [::]:80 will # bind to port 80 IPv6 only. # In order to use port 80 for all interfaces, both IPv4 and IPv6, use either the # configuration "80,[::]:80" (create one socket for IPv4 and one for IPv6 only), or # "+80" (create one socket for both, IPv4 and IPv6). The + notation to use IPv4 and # IPv6 will only work if no network interface is specified. Depending on your # operating system version and IPv6 network environment, some configurations might not # work as expected, so you have to test to find the configuration most suitable for # your needs. In case "+80" does not work for your environment, you need to use # "80,[::]:80". # If the port is TLS/SSL, a letter 's' must be appended, for example, "80,443s" will # open port 80 and port 443, and connections on port 443 will be encrypted. For # non-encrypted ports, it is allowed to append letter 'r' (as in redirect). Redirected # ports will redirect all their traffic to the first configured SSL port. For example, # if webserver.port is "80r,443s", then all HTTP traffic coming at port 80 will be # redirected to HTTPS port 443. If this value is not set (empty string), the web # server will not be started and, hence, the API will not be available. # # Possible values are: # comma-separated list of <[ip_address:]port> port = "80,[::]:80,443s,[::]:443s"
Hello and many thanks for your answer. Sorry that I didn't provide more details. I'm using V6 Docker image and I need to host admin interface on any other port than 80. I need to have this port available for auto discovery and distribution of proxy.pac file.
My question was how to change port on which is Pi-Hole administrative interface listening, I was looking into running container, but I was unable to find any config file where it is defined, but your answer was the perfect one.
Many thanks for your kind help!
You need to understand how ports work when you use docker containers.
You will use a port from your host (8080
, for example) and this port will connect to port 80
inside the container.
You don't need to change the port inside the container. You just need to tell docker to use the correct port.
You need to add -p 8080:80
to your docker run
command.
If you are using a compose file, you need to use the correct port number in ports
section.
Here you can find an example of a compose file: docker-pi-hole/README.md at be48e1186b669e747f9df10b49bac6976fc6f715 · pi-hole/docker-pi-hole · GitHub.
You just need to change 80:80/tcp
to 8080:80/tcp
.
Unfortunately, on docker i use the host
network mode, so the port setting on the docker file its not working on me.. for v5, we had the WEB_PORT: 7000
variable that was the config that worked for me, unfortunately, seems like on v6 this is not an option anymore...
Changing the pihole.toml file did the trick form me. thanks!
It's in the manual that was linked from the announcement post