Move Pihole to a different folder or maybe create virtual host

Hi guys,

I wanted know if is somehow possible to move pihole to a different folder within lighttpd possibly pihole ?
So the admin can access the webgui through a different path in it is browser .
By entering in the browser for e.g http://localhost/pihole ?
This way I could also run and manage other services on the same Pi without running into conflicts when managing them from the browser.

thx,user4747

1 Like

Have you tried looking in the file /etc/lighttpd/lighttpd.conf and changing the line server.document-root to your preferred point of access?

I found this by looking into the install script.

There may need to be some other links needing changed within the files in the admin folder (once you move it), but I'm not sure as I haven't delved in.

At least it's a starting point.

Yes I just modified my /etc/lighttpd/lighttpd.conf by adding a extra line

#server.document-root = "/var/www/html"
server.document-root = "/var/www/pihole"

and added a folder called pihole in "var/www".
I also changed the owner for that new folder to www-data www-data and copied the content of "/var/www/html" to "/var/www/pihole".
finally I restarted lighttpd and tried to access the webgui as 192.168.178.34/pihole.

However the browser replied with

"This 192.168.178.34 page can’t be found"

Does anybody have a idea of what I could be missing ?

Each time you update pi hole the lighttpd.conf get replaced whit default one

Thx for that hint.
However my pihole installation is brand new and I just double checked both lines are still there.

After copying everything over and making the changes noted, make sure you are accessing the admin page at http://192.168.178.34/pihole/admin.

Sorry guys.
the browser stills says

The webpage cannot be found.
I wounder where else to look

hey you can just change that by editing the func.php file which you can find in the admin folder /scripts/pi-hole/php/func.php and change the 'checkfile' function so it becomes like this...

function checkfile($filename) {
    if(is_readable($_SERVER['DOCUMENT_ROOT']."/pihole/".$filename))
    {
        return "pihole/".$filename;
    }
    else ........

note that the "/pihole/" part needs to be changed to what ever directory the files are located in ... after that it works just fine calling the admin like http://192.168.178.25:8080/pihole/admin (just a note that i run the web interface on serperate port making the need to change that kinda overkill :D)
Changing it in the way of updating the function you dont need to change you server.document-root folder, so you can make use out of lighttp with different applications like having access to all files in ur www folder via file transfer protocoll for example and not just the pihole interface.
I also just discovered it trying to realize doing what you want to do :stuck_out_tongue: hope i could help even when it might be a bit late in this case