首页 > 解决方案 > Golang https 设置麻烦

问题描述

我在 AWS 上设置 https 时遇到问题:

我通过在我的服务器上使用 certbot 命令从letsencrypt获得证书:

./certbot-auto certonly --standalone -d go.minmacro.com --debug --agree-tos

我收到了成功消息:

恭喜!您的证书和链已保存在:

/etc/letsencrypt/live/go.minmacro.com/fullchain.pem

您的密钥文件已保存在:

/etc/letsencrypt/live/go.minmacro.com/privkey.pem

在我使用的 go 代码中:

err := http.ListenAndServeTLS(":443 ", "/etc/letsencrypt/live/go.minmacro.com/fullchain.pem", "/etc/letsencrypt/live/go.minmacro.com/privkey.pem", r)

fmt.Println(err)

当我运行这段代码时,会抛出一个错误:

监听 tcp:地址 tcp/443:未知端口

即使我已经将 https 添加到我的安全组

谁能给我一个建议?几天来我一直在与这个麻烦作斗争

标签: amazon-web-servicesgohttps

解决方案


推荐阅读