使用nginx反向代理访问homeassistant

必须用下面的配置才可以访问

 

location / {

proxy_pass http://127.0.0.1:8123;

proxy_set_header Host $host;

}

location /api/websocket { proxy_pass http://127.0.0.1:8123/api/websocket;

proxy_set_header Host $host;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "upgrade";

}

 

修改configuration.yaml

添加

http:

  use_x_forwarded_for: true

  trusted_proxies:

    - 172.30.33.1  # 添加访问的ip白名单

参考文献:https://www.bilibili.com/read/cv13120216/

参考文献:http://blog.hanlei.org/assistant%e9%80%9a%e8%bf%87%e8%bf%9c%e7%a8%8b%e4%bb%a3%e7%90%86%e7%99%bb%e5%bd%95%e5%87%ba%e9%94%99%e7%9a%84%e9%97%ae%e9%a2%98/