Container Installation and NGNIX Ports

How would I modify a docker compose file so the NGINX proxy uses the port the Home Assistant container needs? I am running different applications through the same NGINX container and I see how to set it up so it routes to the exact same port for all applications but I don’t see how to route to a different port depending on the application. I suspect there is some variable that needs to be set in the Home Assistant container part of the Docker Compose file.

You generally wouldn’t do that in the HA container - it should just listen on its default 8123. When you set up the proxy host in NGINX, you would just specify the HA host and its default port like http://ha_ip_address:8123. NGINX handles the incoming connections on port 443 and redirects to whatever machine/port the subdomains are expecting.

Any idea how I would set this up? Right now, I have rules like:

ports:
- 80:80
- 443:443

It terminates the SSL at the NGINX proxy and routes to port 80 for any internal containers. I need one container to be sent request on port 80 and another to be sent on port 8123.

Your subdomains are different locations for NGINX and each reflect is configured separately. Configuring NGINX is complex, but there are lots of examples here in the forum.

I came across the answer. I have to set the following enviroment variable inside the Home Assistant container:

  - VIRTUAL_PORT=8123