好吧,
正如您从上面可以看到的,对于可以/应该使用哪些端口存在很多混淆。
有些人说在本地端必须是8123,并且你必须在你的配置中指定一个http:条目。不,你不知道!![:smiley: :笑脸:](//www.sz-tiancheng.com/community/images/emoji/twitter/smiley.png?v=9)
Edit (20200512) : ‘sometime’ since this post was written the configuration no longer likes some of the “quotes” so I have included what the ‘modern’ versions of the config are, Note: I did not set it up with these (they were changed by updates to the packages) so can not testify to their equivalency, if you have problems, get back to me and I’ll update this post again.
列表:
- 安装DuckDNS
- 安装NGINX(从核心插件)
- Portforward 443外部到YourHAInstanceIPAddr:443内部(小心你的路由器,记住上面的帖子,这是我的绊脚石)
(不确定这是必要的,但是…)Portforward 80外部到YourHAInstanceIPAddr:80内部
- 找出路由器的WAN IP地址是什么(确保这不是通过CGNAT(基本上的NAT分层),因为它不会在WWW上意味着任何内容。
- 转到duckdns.org并输入您的WAN IP地址,并生成您的令牌(记录此和您的子域duckdns.org如。myfortressofsolitude.duckdns.org)
- 返回DuckDNS添加并更改为配置: -
{“lets_encrypt”:{“accept_terms”:true,“certfile”:“purechain.pem”,“keyfile”:“privkey.pem”},“令牌”:“123456wouldntyouliketoknow123456”,“域”:[“mybortressofsolitude.duckdns.org“”,“秒”:300}
显示的引号是必要的(编辑:最近的实现删除引号,如果你的做了同样的“它一定是好的”)- (edit2(3月2021):语法检查似乎略有繁重,要求存在空键“别名:[]”,如下所示)。以下是我现在的样子: -
Lets_encrypt: accept_terms: true certfile: fullchainpem密钥文件:privkey。Pem token: 123456nottyouliketoknow123456 domains: myfortressofsolitude.duckdns.org aliases: [] seconds: 300
- 保存并启动您的DuckDNS
- 转到你的NGINX Add On并将配置更改为
{
“域”:“myfortressofsolitude.duckdns.org”,
“certfile”:“fullchain.pem”,
“密钥文件”:“privkey.pem”,
“高水位”:“信息= 31536000;includeSubDomains”,
"自定义":{
“活跃”:假,
“默认”:“nginx_proxy_default * . conf”,
“服务器”:“nginx_proxy / * . conf”
}
}
同样,引号是必要的,端口不是,https://前缀也不是(编辑:最近的实现删除引号,如果你的做了同样的“它一定是好的”)再一次;这是我现在的样子:-
域名:MyBredresSofSolitude.duckdns.org certfile:fullchain.pem keyfile:privkey.pem hsts:max-age = 31536000;包含UBDOMAINSCloudFlare:False Customize:Active:False默认值:nginx_proxy_default * .conf服务器:nginx_proxy / *。conf
- 保存并启动你的NGINX(保持刷新日志直到它生成parms/keys并说" starting NGINX…"然后再等待60秒。
- 转到您的配置.YAML并在http下注释出任何东西:包括“http:”本身
- 重新启动路由器(确认,确认)
- 重新启动您的HASS实例(确保,确保,确保)
- 转到https://myfortressofsolitude.duckdns.org并登录您的HA实例(您确实设置了密码等。不是吗
![:wink: 眨眼:](//www.sz-tiancheng.com/community/images/emoji/twitter/wink.png?v=9)
)
- 现在,您可以返回并删除端口80的端口转发,并从nginx中删除相同的端口转发(如果您这样做了的话)。有人说端口80对于生成密钥和进行设置duckdns的协商是必要的——我不知道
- 现在,您“应该”能够在本地访问您的HA(局域网和xxx.xxx.xxx. xxx.)。xxx: 8123或hassio。local:8123(随便吧,我从来没用过)和Remote (https://xxxx.duckdns.org.(注:外部无端口号)
- 去喝一杯庆祝一下,这是你应得的!
![:partying_face: :派对_face:](//www.sz-tiancheng.com/community/images/emoji/twitter/partying_face.png?v=9)
注意:我注意到我的证书自上述安装以来已经“自我更新”了两次,这是仅暴露端口443(但加密),我自己没有干预。
编辑:我注意到,截至20191114 - 7人点击了https://myfortressofsolitude.duckdns.org-只是让你知道,我没那么蠢!![:crazy_face: :crazy_face:](//www.sz-tiancheng.com/community/images/emoji/twitter/crazy_face.png?v=9)
20200202这是29人点击 - 真的,你认为你会发现什么?