PiHole directing own domain to 127.0.0.1

Hardware: VPS bought online
YunoHost version: 3.6.4.6
I have access to my server : Through SSH + through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I recently installed PiHole on my yunohost with default settings, not using as a DHCP server. It works great, except when I try to access the server through the domain I have pointing at it. In other words, while using the pihole DNS server, when going to mydomain.tld (which points to the yunohost install on a vps), I fail to connect. When going to any other domain, it works as expected.
I pinged my domain while using pihole DNS, and found out that it’s trying to go to 127.0.0.1.
I noticed that the settings page on my pihole webportal shows: image (not shown is my domain)
I assume that the ip should not be set to localhost, but rather the server’s external ip. It seems that normally you would do pihole -r to reconfigure pihole, but that doesn’t seem to work on yunohost:

$ sudo pihole -r
(after going through ncurses ui)
[i] Logging On.
[i] Performing reconfiguration, skipping download of local repos
[✓] Resetting repository within /etc/.pihole... 
Unable to reset /var/www/html/admin, exiting installer

I feel that this can’t be an uncommon problem, since it happens consistently with default install, but I haven’t managed to find any help.

Does anyone know how I can fix this issue?

hmmm and so from your server, is your domain name resolved to 127.0.0.1 or to the global IP ?

If I ping my domain name from the VPS that yunohost+pihole is running on, it tries to reach the external IP of the server.

It might be worth mentioning that this might be an intended feature, as mentioned here:

Hi

That may be more a problem with your /etc/hosts than pihole’s config.
The hosts file on your server resolve any local domain you have to its local address.
As you use a VPS, you should probably comment those lines.

This fixed the issue, thanks!

I set manage_etc_hosts to false in /etc/cloud/cloud.cfg then added “myipv4 domain.tld” and “myip6 domain.tld” to the /etc/hosts file, and everything seems to work fine now.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.