I have the Nginx SSL Proxy and Duckdns addons set up on my Home assistant instance, allowing me to access it externally with SSL from a domain such as hass.duckdns.org. I have port forwarding set up on my router so that port 443 (for SSL) is forwarded to my Hass instance, as port 443 is being monitored by Nginx.
I also have Bitwarden RS set up as an addon, and I can currently access this externally using hass.duckdns.org:7277.
Is there any way to change this so that I have another domain such as hassbitwarden.duckdns.org, which, when the domain is entered (without the need to append the specific port), the Nginx proxy picks this up, and, based on the url, routes this domain through to Bitwarden_RS?
Nginx can definitely do this, but I don’t think the HA addon has that functionality.
Bottom-line: If you want this, you’ll have to install your own nginx, not the HA version.
I just figured out how to do this! It’s possible to proxy multiple domains and ports using the customize.active and customize.servers options.
I’ve set up SSL for my Home Assistant server using the “Lets Encrypt” and “NGINX Home Assistant SSL proxy” addons. I wanted to set this up for some other services that I run on my server, and some add-ons that expose a port with an HTTP web server (not SSL.) For example, I’m using the CompreFace add-on for facial recognition, and the web UI is over HTTP. It also doesn’t support HA’s built-in ingress feature (which would have made this much easier.) So I wanted to set up my own ingress with the nginx proxy add-on, add a link to the sidebar, and show the UI in an iframe using panel_iframe. (An SSL proxy is required because you can’t view an HTTP page in an iframe if the parent page uses HTTPS.)
It took me a while to figure this out, but it’s actually pretty simple. Here’s how to set up multiple servers for NGINX Home Assistant SSL proxy.
Requirements
You will already need to have SSL working on a custom domain or subdomain.
Back on your host server (not in the nginx proxy Docker container), create a new directory at: /usr/share/hassio/share/nginx_proxy/:
mkdir -p /usr/share/hassio/share/nginx_proxy
Create new file in this directory. For my CompreFace add-on proxy, I created a file at: /usr/share/hassio/share/nginx_proxy/compreface.conf
Paste your copied Nginx server { ... } section in here.
Replace YOUR_DOMAIN with the new domain (or subdomain)
Replace the port (8123) in http://homeassistant.local.hass.io:8123 with the port for your service that is running on the host server. For example, if you have a service running at port 4567, this line would now be:
I wonder, what if the page I’m trying to reach isn’t running on the machine running home assistant? Say, I wanted to get to the page for my router or my NAS - how would I change the last step in the above instructions?
Just replace this url with whatever you want. It’s just a url. Doesn’t even have to be in your network, could be https://google.com
That being said, I definitely recommend just checking out the nginx proxy manager addon instead. It’s much easier to use:
Manage all your routes in a GUI
Add/remove routes without needing to restart anything
Get let’s encrypt certificates for each subdomain and have npm automatically keep them up to date with one checkbox (again, without restarting anything)
Hey I’m aware this post is quite old but it pointed me in the correct direction. I’m writing this as of 12/24. I’m pretty much in agreement with the instructions within the original post, however he stated:
mkdir -p /usr/share/hassio/share/nginx_proxy
This is not correct. I’ve looked at the configuration and read the documents.
If using HAOS (which is a dockerized version of home assistant), the add-on directory is located at /homeassistant/share. The configuration entered also said look in the nginx_proxy/*.conf. So in actuality all the add-on configurations are going to be added in /homeassistant/share/nginx_proxy/. Just a heads up since this can be confusing. I know HA comes in many flavors. I’m using HAOS so it might be different for other versions.
I specify that I used this procedure in order to be able to access Home Assistant with two different domain names, this means that I did not change the port, but only the domain name.
This allows me to provide access to Home Assistant from a secondary domain name that I can remove at any time if necessary, for example, if there was a security risk if my child lost their phone.
Of course, you must remember to create a second domain name on DuckDNS.org and add it to the Home Assistant Addon.