Come v6 release of Pi-hole, the lighttpd and php dependencies are removed.
You can find hints here on Discourse.
So why bother when all gets replaced by a single FTL binary/daemon that does almost all the work.
Only that this is relelvant to installations being done right now. This might be an edge case - I don't know, but a google search indicates this is not the first time users have struggled with pihole being installed on a platform which hosts other sites. So it's another tool in the box. That's all.
I have edited the solution again today on 08/10/2022 because it was discovered that on a reboot or restart of pihole, the ownership of the lighttpd log and run folders get reset to www-data, presumably by pihole FTM. So I have forced the issue by using a custom script to ensure the permissions are set to the custom lighttpd user every time lighttpd is started. This method avoids any tinkering with the pihole code.
I'm not sure I'd follow your approach to have Pi-hole's lighttpd coexist with another web service running under Apache requiring you to use an unconventional user.
By convention, many web-related packages would refer to www-data by default, including Apache, nginx, lighttpd, php-fpm,... (though this may vary by OS).
You may be inviting all kinds of difficulties by trying to force another default web user/group on all of your system components.
I was going to suggest that you may try installing Pi-hole's web UI without installing its lighttpd webserver when I stumbled about a post by FreePBX developers explicitly advising to completely separate FreePBX and Pi-hole:
A clean way to separate FreePBX and Pi-hole while still using a single machine to host them both may be to run them both in Docker containers, or at least one of them.
Did you consider running a dockered Pi-hole?
You could well be right that Docker is a better way. I haven't explored that... yet.
With that said, I've pretty much got them playing well together now by using the 'asterisk' user for lighttpd (which is installed by the freepbx package alongside apache) and putting the apache GUI on a different port. I also moved the FreePBX webroot to /var/www/raspbx so that lighttpd has /var/www/html all to itself.
So, lighttpd will run on port 80 totally independently without risk of conflict with FreePBX and I have now found that the directory owner and permission changes needed for lighttpd to run as a different user, all seem to be handled by system.d during boot. I will go back and edit the solution (for the umpteenth time) to reflect this new discovery which makes it all surprisingly easy... as most things are when you do it the right way. Done ![]()
Sounds good; take extra care to keep periodic backups of everything, in case an update to either service resets your modifications and breaks it.