I'm adding this here in case anyone else needs it. But mostly so I can "Google" it the next time I install Pi-hole on Apache.
Installing Pi-hole on an existing and working Apache web server on Raspberry Pi. This assumes you have set up your own static IP and whatnot.
- Run the Pi-hole install. When you get to "Do you wish to install the web server" select "Off".
- Finish the Pi-hole installation process. Do not panic.
- Run "sudo usermod -a -G pihole www-data"
- Install "sudo apt install php-sqlite3"
- At a minimum, restart Apache "sudo service apache2 restart" or reboot the Pi.
- Enjoy.
5 Likes
Thank you, this was helpful! Just wanted to add two things in case it helps someone else.
- If you have Apache but not PHP yet, run
sudo apt install php libapache2-mod-php
.
- On a fresh install of Pi-hole v5.3.1 the group membership was already setup (edit: but that's probably because I installed lighttpd).
2 Likes
I am working from a NextCloud install first then installing PiHole afterwards. I had trouble allowing the correct access via different port than 80. I chose 81.
- Added it to new pihole.conf in the /etc/apache2/sites-available
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/pihole.conf
sudo nano /etc/apache2/sites-available/pihole.conf
added or edited the following lines:
<VirtualHost *:81>
DocumentRoot /var/www/html/admin/
<Directory /var/www/html/admin/>
- Added a new Listen port in the port.conf
sudo nano /var/apache2/ports.conf
add line:
Listen 81
- Whitelisted the directories for pihole specifically in the apache2.conf
sudo nano /var/apache2/ports.conf
add lines at the appropriate spot:
<Directory /var/www/html/pihole/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
<Directory /var/www/html/admin/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
- Finally update the Apache2 config files & restart service
sudo a2ensite pihole
sudo systemctl reload apache2
β
Not sure if that was all overkill or I opened it up too much but that I how I got it working on my R-Pi 4.
Documenting it to help out anyone else who was a NOOB like meβ¦
1 Like
I have managed to get the dashboard working by installing the following packages with apache+php8.0
php8.0-sqlite3
php8.0-fpm
You will also need to do
a2enconf php8.0-fpm
1 Like
This last bit did the trick for me. Thank you.
I am running bullseye on a Raspberry Pi 3.