pi-hole: change default web admin port

If you run another web server on your raspberry pi such as nginx etc you’ll need to change the default port “80” for your pi-hole’s web admin. This guide applies to the default lighthttpd web server installed with pi-hole.

EDIT: 2020-10-06 – fixed sed command syntax. replaced single quote with double quotes. Was giving an expression #1 char unknown error.
EDIT: 2021-04-22 – Suggestion from Karl-Heinz E.


Alternate Method

edit the file /etc/lighttpd/external.conf and add:
server.port := 8093

 


Previous method:

Begin by making a backup of the pi-hole lighttpd config

sudo cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.backup

Next replace the default port 80 with a port of your choice (example below uses port 8093).

sudo sed -ie “s/= 80/= 8093/g” /etc/lighttpd/lighttpd.conf

Finally restart the lighttpd daemon.

sudo /etc/init.d/lighttpd restart

Connect to the pi-hole’s web admin in your browser using your newly updated port.

//192.168.x.x:8093/admin
//pi-hole.your.domain:8093/admin

Note: When you update pi-hole this change will be overwritten.

PI-HOLE DNS