My Docker Stack

That’s good to hear. Could you share your config? Perhaps it was necessary to alter the proxy configuration file for home assistant? Because for me, if I disable network host I cannot reach Hass through the proxy. If I disable network mode host it works fine, without any changes to the proxy config file.

here is my HA docker command:

sudo docker run -d --name="home-assistant" --restart=unless-stopped -v /home/finity/docker/hass-config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant

and my letsencrypt docker command:

sudo docker run -d --cap-add=NET_ADMIN --name=letsencrypt --restart=unless-stopped -v /home/finity/docker/letsencrypt/config:/config -v /etc/localtime:/etc/localtime:ro -e PGID=1000 -e PUID=1000 -e [email protected] -e URL=my_domain.duckdns.org -e SUBDOMAINS=hass,conf,graf -e VALIDATION=http -p 80:80 -p 443:443 -e TZ=America/New_York linuxserver/letsencrypt

and my NGINX conf file (I haven’t set up Grafana or the Configurator so I can’t say those work or not):

# main server block
server {
    listen 443 ssl default_server;
 
    root /config/www;
    index index.html index.htm index.php;
 
    server_name my_domain.duckdns.org;
 
    # enable subfolder method reverse proxy confs
    include /config/nginx/proxy-confs/*.subfolder.conf;
 
    # all ssl related config moved to ssl.conf
    include /config/nginx/ssl.conf;
 
    client_max_body_size 0;
 
    location / {
        try_files $uri $uri/ /index.html /index.php?$args =404;
    }
 
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # With php7-cgi alone:
        fastcgi_pass 192.168.1.11:9000;
        # With php7-fpm:
        #fastcgi_pass unix:/var/run/php7-fpm.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
    }
}
 
### HOMEASSISTANT ##############################################################
server {
    listen 443 ssl;
 
    root /config/www;
    index index.html index.htm index.php;
 
    server_name hass.my_domain.duckdns.org;
 
    include /config/nginx/ssl.conf;
 
    client_max_body_size 0;
 
    location / {
#       auth_basic "Restricted";
#       auth_basic_user_file /config/nginx/.htpasswd;
        proxy_set_header Host $host;
        proxy_redirect http:// https://;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
		proxy_set_header x-ha-access "MyHAPassword";
        proxy_buffering               off;
        proxy_ssl_verify              off;
#       include /config/nginx/proxy.conf;
        proxy_pass http://192.168.1.11:8123;
    }
}
 
# enable subdomain method reverse proxy confs
include /config/nginx/proxy-confs/*.subdomain.conf;
1 Like

Amazing, it works! Thanks for your help :grinning:

what was the difference between mine and yours?

I was using the default subdomain homeassistant sample file provided by the container, unedited. This uses the default proxy configuration, which is not correct apparently.

Thanks that helped for me mate.