Update:
I've been able to get PiHole to semi-work with Apache. The DHCP server works like a charm now at least. My steps to get PiHole working:
- Completely uninstalled PiHole
- Make sure /etc/dhcpcd.conf is accurate. Note that I'm running my Pi on WiFi right now, so the interface is wlan0. I've assigned a static IP address to my Pi and used that same address in the DNS. Example below.
interface wlan0
static ip_address=192.168.1.15/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.15
- Reinstall PiHole, do not install the lighttpd server.
- Edit /etc/apache2/sites-available/000-default.conf to:
<VirtualHost *:80>
ServerName pi.hole
ServerAlias www.pi.hole
ServerAdmin zykirion@localhost
DocumentRoot /var/www/html/admin
ErrorLog ${APACHE_LOG_DIR}/pihole_error.log
CustomLog ${APACHE_LOG_DIR}/pihole_access.log combined
</VirtualHost>
- Add more sites if needed within /etc/apache2/sites-available/. Note the hole domain in ServerName. For whatever reason, this is the only safe domain I have been able to get working on all my devices and browsers so far. Example:
# /etc/apache2/sites-available/home.hole.conf
<VirtualHost *:80>
ServerName www.home.hole
ServerAlias www.home.hole
ServerAdmin zykirion@localhost
DocumentRoot /var/www/html/home
ErrorLog ${APACHE_LOG_DIR}/home_error.log
CustomLog ${APACHE_LOG_DIR}/home_access.log combined
</VirtualHost>
- For each site you add, make sure to run sudo a2ensite [filename].conf
- If you have a firewall installed, make sure to open the ports found here (includes examples of how to open ports).
- Restart your Pi.
- Log into your pi.hole and go to "Local DNS Records". Add records pointing to all your web sites. For example: pi.hole -> 192.168.1.15, www.pi.hole -> 192.168.1.15, etc...
- Within your pi.hole administration panel, go to Settings -> DHCP and make sure the Range of IP addresses to hand out is correct (match with DHCP values in router).
- Within your pi.hole administration panel, go to Settings -> DHCP and add a Static DHCP lease to your PI.
- On my router (from Spectrum), I made sure to turn off DHCP and DHCPv6. It was found in Advanced -> Router Settings. Browse the DHCP and DHCPv6 drop downs to turn each off.
Note: I have not gotten the ad block to work, and I am still getting a constant error when attempting to visit the Network tab within pi.hole. I get an error code 500 from the api_db.php script. PiHole's dashboard is also showing that nothing is happening, but pi.hole -> Settings -> DHCP does show the correct leases for all devices on my network.
I'll keep this post updated if I figure out anything else, just in case someone else is in my position.
Edit: On iPhones (Safari browser) you need to add the last '/' to the end of the URL for it to work.