Strange nginx proxy manager issue reddit / selfhosted ---------------------------------------------------------------------- williamwgant · 2023-11-01 13:01 Greetings, I started out by spinning up a number of docker-compose setups for various things. Initially, I set everything up with static IP addresses, but I later understood that nginx proxy manager can, if on the same network as a container, reference the container by hostname (or so I thought). However, after moving a few containers over to just being on the network, nginx now returns a bad gateway error on those containers. Am I just misunderstanding something? NGINX proxy manager is on that network as well (I just have one network for the moment). Any ideas of what I could be doing wrong? ---------------------------------------------------------------------- Significant_Chef_945 · 2023-11-01 13:35 How does NGinx Proxy Manager know how to connect the hostname to the respective IP addresses? Do you have a local /etc/host entry on your server, do you use DNS lookups, something else? ---------------------------------------------------------------------- heehoX · 2023-11-01 13:41 I use a similar setup, my docker containers are in the same network as the reverse proxy. In my experience, Bad Gateway is usually caused by incorrect mapping of values for Scheme, Hostname or Port. One think you can do is to check if the containers are actually connected to the network using docker network inspect ---------------------------------------------------------------------- thekrautboy · 2023-11-01 14:04 When you say "by hostname" of the containers, are you using the exact containername of the target service? You can try to `docker exec` into the NPM container and from there ping the target container by its name, to confirm the connection itself works, if it does then the problem is somehow NPM itself i guess. Or the target container is not responding properly. /r/NginxProxyManager exists ---------------------------------------------------------------------- williamwgant · 2023-11-01 20:44 They are in the same network and I've set the hostname and container\_name on the containers. ---------------------------------------------------------------------- williamwgant · 2023-11-01 20:50 The container name and the hostname (as specified in the docker- compose file) are the same. I used that same value in npm. Yeah, I had considered asking in the nginxproxymanager group, but I wasn't sure that was necessarily how I was stepping on myself. And you people got me to the point where I was comfortable (and actually enjoy) dinking around with docker, so I figured I'd ask here first. I usually come here first when I step on a rake as far as the self- hosting stuff, as the community has been super helpful to me. ---------------------------------------------------------------------- williamwgant · 2023-11-02 10:47 So... it's weird. I went in Portainer after changing a single container to not have a static IP address. Instead of being an address above [192.168.10.128](https://192.168.10.128) (as the network is configured), it lists the IP as being on the network, but is at [192.168.10.4](https://192.168.10.4), which is the static IP address assigned to my NAS (the router dynamically assigns IPs for other things up to [192.168.10.100](https://192.168.10.100)). I essentially split a /24 into two /25s, with the upper one being allocated for docker containers. I'm wondering if I couldn't just set everything to be on the host network and be done with it. Any thoughts? ---------------------------------------------------------------------- heehoX · 2023-11-03 06:11 What I can suggest is to create a new docker network in bridge mode, then transfer all your containers to that network and see if it works. What I do when I want my container to be accessible only in nginx proxy manager is to comment out the port section of my docker compose file, that way the ports are not exposed to the host but still accessible by the reverse proxy container. I then create an entry for that container in NPM to access it.