Now that the new version has its own embed webserver, I don't need to keep the /admin/ directory in the lighttpd root, that I use for other purposes on the home server.
I found that I can edit the pihole.toml
file easily to reflect that:
[...]
740 [webserver.paths]
741 # Server root on the host
742 #
743 # Possible values are:
744 # <valid path>
745 webroot = "/var/www/pihole" ### CHANGED, default = "/var/www/html"
746
747 # Sub-directory of the root containing the web interface
748 #
749 # Possible values are:
750 # <valid subpath>, both slashes are needed!
751 webhome = "/admin/"
752
753 [webserver.interface]
754 # Should the web interface use the boxed layout?
755 boxed = false ### CHANGED, default = true
[...]
And it worked like a charm. The problem is that the update script don't consider this change and when trying to run pihole -up
it fails and asks me to reinstall Pi-Hole from the website.
I suggest adding a function like this to update.sh
so it can handle this scenario:
#!/bin/bash
# Read webroot and webhome path from /etc/pihole/pihole.toml
get_admin_interface_dir() {
local webroot_path webhome_path
webroot_path=$(sed -n 's/^\s*webroot\s*=\s*"\(.*\)"/\1/p' /etc/pihole/pihole.toml)
webhome_path=$(sed -n 's/^\s*webhome\s*=\s*"\(.*\)"/\1/p' /etc/pihole/pihole.toml)
echo "${webroot_path}${webhome_path}" # Construct the full path
}
echo $(get_admin_interface_dir)
Please, note I'm not very good with sed and bash script and I know this is not a proper way to read the .toml file, just a boilerplate code to demonstrate the idea.