【问题标题】:GCP => listen tcp :443: bind: permission deniedGCP => 监听 tcp :443: 绑定: 权限被拒绝
【发布时间】:2019-07-08 11:21:22
【问题描述】:

我在尝试使用 golang + let's encrypt 在 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'.

【问题讨论】:

  • 其他进程已经在 443 监听。
  • @freakish 这不是真的,如果另一个进程正在侦听同一端口。你会得到bind: address already in use 错误。
  • 啊,很公平。你是对的,默认情况下 Linux 服务器不允许访问低端口。

标签: go https google-cloud-platform lets-encrypt


【解决方案1】:

如果要绑定到privileged port(端口小于 1024)。你要么需要root,要么拥有CAP_NET_BIND_SERVICE 能力。

【讨论】:

    【解决方案2】:

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

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

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

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

    【讨论】:

    • 你得到最终解决方案了吗?
    【解决方案3】:

    使用 iptables 进行端口重定向。通过 flappysocks 查看这个答案 https://stackoverflow.com/a/1762807/1100242

    【讨论】:

      猜你喜欢
      • 2021-10-30
      • 2020-05-28
      • 2021-12-27
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 2020-06-14
      • 2020-04-13
      • 2020-10-23
      相关资源
      最近更新 更多