Had my LAMP server up and running nicely and was able to see the default Debian/Apache page on my domain. But since setting up Pi-hole to block Ads on my network, I just receive a page that say’s ‘Blocked by Pi-hole’.
There’s a FAQ on Pi-hole Userspace that seems to be about the problem.
Is there a way around this? I couldn’t really make much sense of the possible solutions on there, try running it through a different port, or changing from the default page?
Not really sure what I’m talking about , but I do feel this is a problem that’s not just specific to me.
When PiHole blocks a advert, it redirects the request on port 80, to the IP address of the device. Because that device is running a webserver, you end up seeing the default webpage (/var/www/index.html). This page contains the text “blocked by PiHole”.
If we look at /etc/pihole/gravity.list, we can see how it works:
192.168.0.111 001wen.com
The above shows that any requests made to 001wen.com will be redirected to 192.168.0.111.
Theres a few options to free up the webserver’s default page: Option 1:
Change all IP address entries in /etc/pihole/gravity.list to a null IP address, eg: 0.0.0.0 . The advert will still be blocked, but it wont be redirected to the webpage on the device. This then free’s up /var/www/index.html.
#Redirect blocked sites to a null IP address
sed -i "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/0.0.0.0/" /etc/pihole/gravity.list
Option 2:
Overwrite /var/www/index.html with something else. Bear in mind, this page will also be displayed on the client device, everytime PiHole blocks an advert.
Option 3:
Move your website to a subdirectory, eg: /var/www/mywebsite/index.html, then you can access the site with http://myserver/mywebsite
Hi Fourdee, thanks for your extensive reply! I have a lot better idea of what’s going on now, one of these options will definitely work for me I’m sure.
The webpage will still exist after uninstall. If the default page is showing “Blocked by PiHole”, you can remove it with:
rm /var/www/index.html
You will then need to replace the file above with something else as your default website page. Or you can redirect it to another folder (eg /var/www/owncloud).
If you need assistance with setting this up, or, still having issues, just let me know.