Pi-hole interfering with website (port 80?) Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Deleted User 612

Pi-hole interfering with website (port 80?)

Post by Deleted User 612 »

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 https://pi-hole.net/help/ that seems to be about the problem.
Since Pi-hole uses port 80 by default, it can conflict with some existing Websites. It's a known issue that we are working on.
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.

Thanks,

Tin
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Pi-hole interfering with website (port 80?)

Post by Fourdee »

Tin Minnow wrote: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 https://pi-hole.net/help/ that seems to be about the problem.
Since Pi-hole uses port 80 by default, it can conflict with some existing Websites. It's a known issue that we are working on.
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.

Thanks,

Tin
Hi Tin,

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:

Code: Select all

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.

Code: Select all

#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
Untitled.png
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
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Deleted User 612

Re: Pi-hole interfering with website (port 80?)

Post by Deleted User 612 »

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.

Tin
artic
Posts: 22
Joined: Fri Apr 29, 2016 11:54 am

Re: Pi-hole interfering with website (port 80?)

Post by artic »

got the same issue even if i uninstall pihole,, any suggestions? im using lighttpd
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Pi-hole interfering with website (port 80?)

Post by Fourdee »

artic wrote:got the same issue even if i uninstall pihole,, any suggestions? im using lighttpd
The webpage will still exist after uninstall. If the default page is showing "Blocked by PiHole", you can remove it with:

Code: Select all

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.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
artic
Posts: 22
Joined: Fri Apr 29, 2016 11:54 am

Re: Pi-hole interfering with website (port 80?)

Post by artic »

Im having issues to redirect to nextcloud folder,I realized im a newbie >_> thx in advance

ps i switched to apache2 and now i cant change back to lighttpd :lol:
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Pi-hole interfering with website (port 80?)

Post by Fourdee »

artic wrote:Im having issues to redirect to nextcloud folder,I realized im a newbie >_> thx in advance

ps i switched to apache2 and now i cant change back to lighttpd :lol:
We can change the default directory Apache2 uses, see below:

You'll need to edit the following file:

Code: Select all

nano /etc/apache2/sites-available/000-default.conf
Find that line that says DocumentRoot /var/www and change to:

Code: Select all

DocumentRoot /var/www/nextcloud
To save changes, press:
CTRL+X, press Y, then press enter.

Restart the services with:

Code: Select all

dietpi-services restart
When you goto your http://ipaddress, Next cloud should be the default page.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
artic
Posts: 22
Joined: Fri Apr 29, 2016 11:54 am

Re: Pi-hole interfering with website (port 80?)

Post by artic »

done, but now I see the apache2 debian default page , this has no sense, it should works
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Pi-hole interfering with website (port 80?)

Post by Fourdee »

artic wrote:done, but now I see the apache2 debian default page , this has no sense, it should works
Yep, can you paste contents of:

Code: Select all

cat /etc/apache2/sites-available/000-default.conf
And make sure you restarted services:

Code: Select all

dietpi-services restart
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
artic
Posts: 22
Joined: Fri Apr 29, 2016 11:54 am

Re: Pi-hole interfering with website (port 80?)

Post by artic »

Code: Select all

ErrorLog /error.log
        #CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =myserver.duckdns.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
Post Reply