Update pihole.md

This commit is contained in:
Jérémie DUCASTEL
2020-11-03 22:00:17 +01:00
parent d1bf15eb87
commit 21dc360c96

View File

@ -42,3 +42,108 @@ Vous ne pourrez pas vous connecter aux périphériques avec leurs noms dhôte
Si les deux inconvénients ci-dessus sont des pactes pour vous, vous pouvez les surmonter partiellement en utilisant le fichier PiHole Hosts ou en publiant complètement ladresse IP de PiHole via Dnsmasq dans un routeur (si cette fonction est prise en charge).
>
>Notez que si vous choisissez cette méthode, vous devrez renouveler les baux DHCP fournis par le routeur. Pour ce faire, le plus simple consiste à redémarrer le routeur.
## faire tourner d'autres sites avec Apache
https://discourse.pi-hole.net/t/migrating-pi-hole-from-lighttpd-to-apache/152/14 :
> I just installed pihole on ubuntu server and because I already use Apache & PHP I uninstalled lighttpd.
I have several virtual sites on Apache so I added also pihole; all work without problems.
> Here it is my config if anybody need to replicate for his use:
edit: /etc/apache2/sites-available/000-default.conf
```
#=== pihole WEBSITE ===
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName pihole
ServerAlias pi.hole
DocumentRoot /var/www/html/dns
<Directory /var/www/html/dns/>
Options FollowSymLinks MultiViews
AllowOverride all
Order deny,allow
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/pihole_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/pihole_access.log combined
</VirtualHost>
#=== site1 WEBSITE ===
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName site1
DocumentRoot /var/www/html/site1
<Directory /var/www/html/site1/>
Options FollowSymLinks MultiViews
AllowOverride all
Order deny,allow
Deny from all
allow from 127.0.0.1
allow from 10.22.22.0/24
</Directory>
ErrorLog ${APACHE_LOG_DIR}/site1_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/site1_access.log combined
</VirtualHost>
#==== site2 WEBSITE ====
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName webtv
DocumentRoot /var/www/html/site2
<Directory /var/www/html/site2/>
Options FollowSymLinks MultiViews
AllowOverride all
Order deny,allow
Deny from all
allow from 10.22.22.0/24
allow from 127.0.0.1
</Directory>
ErrorLog ${APACHE_LOG_DIR}/site2_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/site2_access.log combined
</VirtualHost>
```
> edit your server hosts file so you can access any website you need from server,
( if you host your custom files for blocking):
```
# /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu1
127.0.1.2 pihole
127.0.1.3 site1
127.0.1.4 site2
10.22.22.16 site1
10.22.22.16 site2
10.22.22.16 pihole
10.22.22.16 ubuntu1
```
> copy all web files for pihole ( move it from /var/www/html/ ) and also content from pihole in dns:
it will look like this:
/var/www/html/dns/admin/...
/var/www/html/dns/pihole/...
/var/www/html/dns/blockingpage.css
/var/www/html/dns/index.js
/var/www/html/dns/index.php
/var/www/html/site1/...
/var/www/html/site2/...
> If I did not forgot something this is all you need to change to have pihole working in Apache, so now reload/restart apache.