[SOLVED] DNS issues when mixing Pi-hole, Docker and Nginx

Howdy,

I am trying to set up a home server (using a Xeon E5 2630L v3) with what seems like a classic configuration : docker as a base, portainer to manage the containers and Nginx (also in a docker container) as a reverse-proxy. The first container I want to use is nextcloud.

I have also a RPi3 running pi-hole,works as my DHCP server and with unbound, no issue up to this point.

I managed to get portainer, nextcloud and nginx proxy manager installed. I can access nextcloud on port 8080, portainer on port 9000 and nginx reverse proxy on port 81. I see everything running in portainer.

The issue however is the reverse proxy functionality. For now I only want the server to work on my local network. So I added nextcloud.testdomain.fr and mapped it to the server local IP address in the pi-hole Local DNS/DNS Records page. In Nginx Proxy Manager I created a proxy host with nextcloud.testdomain.fr as source and nextcloud_app_1:80 as destination. I did the same for portainer and nginx.

Now if I connect to the the server IP, I see the nginx 404 page as expected. However, when I try to connect to nextcloud.testdomain.fr I see the default “Welcome to nginx!” page instead of the nextcloud interface.

I am at the point where, in the documentation I found, it should “just work” but I does not, and I do not know what to try anymore or what the issue can be : pi-hole setup, nginx setup or containers setup. I am also intrigued by the “Welcome to nginx!” page I see, because I would either expect the 404 error as configured or the appropriate nextcloud/nginx/portainer web UI.

Can someone gives me something to check to try to debug this ?

Thanks for your help

I found 3) issues in my setup :

  1. The server did not use pi-hole as its dns server (My ISP does not allow me to set my own DNS server for the whole network). I saw it by making a ping on nextcloud.testdomain.fr from the server and not resolving. I edited /etc/systemd/resolved.conf to set the proper DNS server (+ reboot).
  2. Not all the containers were on the same docker network. In portainer I moved everything on the same network.
  3. I needed to edit nextcloud’s config.php to add nextcloud.testdomain.fr as a trusted domain
2 Likes