Can't login with NGINX

I setup NGINX on a separate server (I love these Hyper V VMs) and was able to setup half a dozen sites that I used to use ports. It went pretty smoothly, including using CertBot to generate the SSL certs. However, trying to bring home assistant into the fold is causing problems (of course it is). Here is my NGINX server config. Note that I use an ip address instead of localhost because it is on a different machine. Since it’s a reverse proxy, I shouldn’t have to do anything in configuration.yaml, correct?

server {
    server_name hassio.example.com;

    location / {
        proxy_pass http://172.16.68.67:8123;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

The docs have sample nginx config

I had better luck with using the following for hassio.example.com

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
    server_name hassio.example.com;

    proxy_buffering off;
    location / {
        proxy_pass http://your.hassio.ip.address:8123;
        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 $connection_upgrade;
    }
}

And then running Certbot with

sudo certbot --nginx -d hassio.noakland.com

1 Like