GCP上的golang =>监听tcp:443:绑定:权限被拒绝

Rob*_*rto 2 https go google-cloud-platform lets-encrypt

尝试使用golang在Google Cloud Platform上设置https时遇到问题,让我们加密

  • 我已经有一个针对实例IP的域

  • 我还让我们对保存在/etc/letsencrypt/live/mydomain.com/上的证书和链进行加密

  • 我已经将myapp设置为使用证书,并配置为通过systemctl使用myapp.service作为服务运行

在完成所有这些配置之后,我总是得到下一条错误消息:


Feb 14 11:29:47 https https[1982]: 2019/02/14 11:29:47 listen tcp :443: bind: permission denied
Feb 14 11:29:47 https systemd[1]: https.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 11:29:47 https systemd[1]: https.service: Unit entered failed state.
Feb 14 11:29:47 https systemd[1]: https.service: Failed with result 'exit-code'.
Run Code Online (Sandbox Code Playgroud)

ifn*_*tak 7

如果要绑定到特权端口(端口小于1024)。您要么是必须的,要么是rootCAP_NET_BIND_SERVICE能力的。


Rob*_*rto 3

好的,我只是寻找有关 CAP_NET_BIND_SERVICE 的更多信息,我在另一篇文章中找到了 Scott Stensland 的答案:

https://unix.stackexchange.com/questions/455221/setcap-not-found-in-debian-9/455234#455234

现在看起来已经修复了...谢谢

但现在我有一个“open /etc/letsencrypt/live/mydomain.com/cert.pem:权限被拒绝”错误:\(正在寻找其他解决方案......)