zilexa/Homeserver

Port 80 overlap between Caddy and Adguard Home

SimpleMachine247 opened this issue · 4 comments

Issue:
When running the containers, Caddy is supplied port 80 in the compose file, but Adguard home wants to use port 80 as well.

Adguard home gives error:
validating ports: listen tcp 0.0.0.0:80: bind: address already in use

The guide does not say anything about needing to change this port for either container. I see that I can change this listen port in Adguard setup to other ports. Is that what I should do?

After a bit more reading , I've found that ports 591, 8080, and 8008 are typical alternatives to port 80 when it's being used. Since 8080 is being used as well for the VPN-proxy, I assume that 8008 is the best path forward for Adguard?

AdGuard uses port 3000 for its webUI. Not 80.
None of these services use or need port 80 outside of the container. Not sure why you have this error?
I don't have this error on my servers.

You could remove port 80 from Caddy for now, depending on which domain provider you use, it should still work without. But recommended to put it back later to ensure proper forwarding.

After you remove it from Caddy, go to your AdGuard webui (which should really be at port 3000) and see what you can configure there. I cannot find anything about port 80 in the UI though.

Aha look here:
https://unraid-guides.com/2021/01/22/how-to-use-host-networking-with-adguard-home-on-unraid/
Indeed, with network_mode: host, you will have port 80 issue with Caddy. Best is to set up your local services first or just remove port 80 from Caddy for now. Then go to Adguard Home webUI: you will get a first-time wizard, there you can change port to 3000. After you did that, you can add port 80 back to Caddy in your compose and run it again.

sorry I setup Adguard Home years ago and don't remember the first-time wizard! I don't see that wizard anymore. Back then, I didn't even know about https web proxy, so I didn't have that setup yet when I ran Adguard Home first time.

Note that the issue you run into only happens when using network_mode: host. Host network is required if you want to use AGH for DHCP for example. Otherwise, you can remove it and it will run in a separate docker network bridge (you can also define your own).
I keep it on host mode even though I do not use its DHCP feature, because I don't think docker network isolation really has any benefits for AGH.. but I am no expert.

Just switched the listen port to 8008 and everything works as expected.