Wildcard Domain in Pi Hole
PiHole is a DNS server that will block ads and website on a DNS level. This is an integral part of my homelab as it blocks a lot of ads on my phones and system, and also easily allows us to manage domains for local application.
For homelab I have a docker-swarm which is managed using portainer. I have a nginx proxy manager to map the ports to a proper domain, even provide https using lets encrypt.But PiHole doesn’t have a wildcard domain setting, hence after i set or before i set a domain my nginx proxy I need to add it to PiHole.
To fix this we need to add a custom configuration in dnsmasq. Underneth PiHole its dnsmasq that manages the domain.
Login to server, and cd /etc/dnsmasq.d/
.
On my current PiHole version (v5.11.4), you will see two files here
01-pihole.conf
06-rfc6761.conf
.
To add custom wildcard top-level domain. You need to create a new file, lets call it: 07-hsps-home.conf
and add the following setttings:
|
|
if you wanted to add a subdomain you could do it like so
|
|
Save it and restart the service or server, and you will be able to use the wildcard domain.