13

How do I change pi hole's URL?

It's currently 10.0.0.20/admin.

I want to use the /admin path for something else but couldn't find a way to change Pi-Hole's path to something else.

1
  • It doesn't look to me as if this is supposed to be changed. If you head for their Github page and search for 'admin' it pulls up half a dozen different entries in half a dozen scripts. That suggests that the 'admin' value has been baked in pretty solidly - I think it might prove tricky (certainly not impossible, but liable to a few failures) to prune out all the instances and replace them with something else that worked.
    – goobering
    Aug 3, 2016 at 10:40

5 Answers 5

16

There are many ways that you could do this, but the easiest is to change the port that pi-hole is using.

Edit /etc/lighttpd/lighttpd.conf and change the line that says server.port = 80 to use some other port number such as 8080. Then restart LigHTTPD using sudo service lighttpd restart, and you will be able to access the pi-hole administrative interface at http://10.0.0.20:8080/admin.

Note that if you ever re-run the pi-hole installer, it will reset this value back to the original port 80.

1
  • 4
    This may have changed but the lighttpd.conf file is now at /etc/lighttpd/lighttpd.conf. That said if you want to make the change last through a pihole update you should put it in a new file called /etc/lighttpd/external.conf.
    – Pathead
    Nov 6, 2019 at 20:13
11

This is another way to change its port and the benefit is that it won't get reset any time you reconfigure pi-hole or update it.

Add server.port := 8000 or your desired port to /etc/lighttpd/external.conf then restart. Then restart lighttpd using sudo systemctl restart lighttpd, and you will be able to access the pi-hole administrative interface at http://localhost:8000/admin.

5
  • Weirdly this causes an error on a restart and lighttpd fails to launch.
    – Colin
    Dec 30, 2020 at 11:02
  • 4
    I think you may have added it like this- server.port = 8000 instead of this- server.port := 8000 , notice the colon? Only after omitting the colon am I able to reproduce the error at launch. Could you clarify if you did that?
    – Bananz0
    Dec 30, 2020 at 12:07
  • 1
    I wonder why : is needed here, whereas in lighttpd.conf not. May 14, 2021 at 13:39
  • 1
    @user3123159 It's the replace syntax: replace : NAME := VALUE (replace/overwrite earlier value) (since 1.4.46) : redmine.lighttpd.net/projects/1/wiki/docs_configuration
    – ibic
    Mar 26, 2023 at 8:02
  • In my new installation of Raspbian and PiHole, it doesn't appear that /etc/lighttpd/external.conf is parsed by lighttp at all. Instead of that path I used /etc/lighttpd/conf-enabled/external.conf and it worked. Aug 14, 2023 at 0:32
1

For whatever reason putting the server.port in external.conf results in an error on restart. Changing it in lighttpd.conf works fine.

To get rid of the /admin in the URL one could create a link in the /html folder. ln admin pi-hole -s

Together with the port change it could look like this http://op:88/pi-hole/ (well the /admin path would still be there, it would just be for cosmetics)

1

It's kinda sad there isn't a more straight forward answer to this. I'd like to do the same as the OP but changing ports negates the point for my use case. The issue is the URL being a common exploit attempt. I know this is a pi-hole feature request rather than a pi related issue...but you should be able to denote your admin URL so you can put a device on the front line and at least remove the obvious things scripts and worms look for.

Basically:

sudo mv /var/www/html/admin /var/www/html/r4nd0N4m3

Then

sudo vi /etc/lighttpd/lighttpd.conf (find and replace admin with r4nd0N4m3.)

Restart the service and maybe your browser if it's caching. Repeat on updates or anything that overwrites the changes...

0

OK.. I just did this... by changing the admin page from /myip/admin to /myip/anything

It's not as straight forward, since the "admin" path are hardcoded. You need change the admin path as well as modify Pi-hole's scripts to make it work.

I am using Ubuntu 20.04 with Apache2 server. However, I believe most server are similar.

  1. Change webpage location:

    sudo mv /www/html/admin /www/html/anything

  2. restart apache2 server

    sudo service apache2 restart

  3. Go to pi-hole script directory

    cd /opt/pihole

  4. Modify any instance of /www/html/admin into /www/html/anything I found following files contains this string:

  uninstall.sh
  updatecheck.sh
  update.sh
  webpage.sh

Just cat *.sh | grep html/admin to find any remaining instance

  1. Profit!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.