I'm installing pihole on my server that already has apache running. I do not want pihole accessible on mydomain.com/admin and since I don't use /var/www/html as my web root I figured I would create a VirtualHost for that directory and put pihole on a subdomain. Here's the VH:
I changed the ownership recursively on /var/www/html to apache:apache
It would appear that I have all the required PHP modules for this admin panel as well. Although I'm not entirely sure how to check that
The admin panel comes up fine it's just that when I make a setting change they don't stick after refresh.
It seems to me there's a permission issue somewhere else that I don't know about. Probably on the database side of things. I believe this is running sqlite which means it should just be a file that needs it's permissions changed on but I don't know where else pihole might be storing files other than /var/www/html
The username under which apache2 runs also needs to be a member of the pihole group to allow writing settings in particular folders (eg. /etc/pihole):
For the lighttpd web daemon that comes default with Pi-hole, this would be the www-data user OOTB:
Configure sudo for the apache user to allow only one command with elevated privileges:
pi@ph5b:~ $ sudo cat /etc/sudoers.d/pihole
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Allows the WebUI to use Pi-hole commands
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
#
www-data ALL=NOPASSWD: /usr/local/bin/pihole
Am not sure if a wildcard * is allowed as you already have the ALL definition.
Why would you use a wildcard, what in a sense is almost the same as full root access, which you previously condemned?
And why is the user still www-data?
Wouldn't you want to create a new file eg: