【问题标题】:Letsencrypt renewal fails: Could not bind to IPv4 or IPv6.. SkippingLetsencrypt 续订失败:无法绑定到 IPv4 或 IPv6 .. 跳过
【发布时间】:2017-12-04 22:32:19
【问题描述】:

我收到的完整错误消息是:

Attempting to renew cert from /etc/letsencrypt/renewal/somedomain.com.conf produced an unexpected error: Problem binding to port 443: Could not bind to IPv4 or IPv6.. Skipping.

这是在 AWS ubuntu 14.04 实例上运行的。所有端口都开放传出,443 开放传入。

【问题讨论】:

  • 我的情况,同样的问题,但我发现我的域没有正确映射到 IP 地址。当我用 A 记录条目固定 IP 地址时,一切对我来说都很好。
  • @TejasTank 可能有相同的症状,但可能是不同的问题

标签: lets-encrypt


【解决方案1】:

当您的服务器已经在端口 443 上运行时,您可能使用(预配置的)--standalone 运行脚本。

您可以在更新之前停止服务器并在之后启动它们。

男人说:

--apache          Use the Apache plugin for authentication & installation
--standalone      Run a standalone webserver for authentication
--nginx           Use the Nginx plugin for authentication & installation
--webroot         Place files in a server's webroot folder for authentication
--manual          Obtain certificates interactively, or using shell script hooks

如果我使用--apache 运行更新,我不会收到任何错误。

【讨论】:

  • 谢谢...使用./certbot-auto renew --apache 并且工作得像个魅力
  • 请注意,使用--apache 需要安装apache 插件。如果没有,则需要在任何自动续订周围添加停止/启动服务器挂钩。
  • 您必须停止服务器才能这样做?
  • Raz: 不,如果你用参数--apache 或--nginx 调用(取决于你使用的服务器)
【解决方案2】:

您只需要在执行此操作之前停止所有正在运行的服务器,例如 Apache、nginx 或 OpenShift。

停止 Nginx

sudo systemctl stop nginx

停止 Apache2

sudo systemctl stop apache2

【讨论】:

  • 工作得很好。谢谢! sudo service apache2 stop 然后sudo certbot certonly --standalone -d www.site.com 工作得很好!
  • 简单而真棒。这就是确切的答案!
  • 这就是答案!
  • 我在 pm2 上运行了一个 nodejs 服务,并在运行 renew 命令之前停止它也有效。竖起大拇指。
  • 这是续订 SSL 证书的唯一选择吗?整个服务器应该在更新时关闭?
【解决方案3】:

正如其他答案中所暗示的,您需要传递正在运行的网络服务器的选项,例如:

没有网络服务器参数:

sudo certbot renew

证书需要更新,自动更新...
更新现有证书
执行以下挑战:example.com 的 tls-sni-01 挑战
清理挑战 尝试从 /etc/letsencrypt/renewal/example.com.conf 更新证书(example.com)产生了意外 错误:
绑定到端口 443 的问题:无法绑定到 IPv4 或 IPv6.. 跳过。

然后,再次使用网络服务器参数(成功):

sudo certbot renew --nginx 

证书需要更新,自动更新...
更新现有证书
执行以下挑战:example.com 的 tls-sni-01 挑战
等待验证...
清理挑战

通过重新加载 nginx 服务器部署新证书;全链是 /etc/letsencrypt/live/example.com/fullchain.pem

恭喜,所有续订成功。以下证书已 更新:/etc/letsencrypt/live/example.com/fullchain.pem(成功)

【讨论】:

  • 这对我有用。我不需要停止服务器。只需要通过 --nginx 标志。
【解决方案4】:

[这是专门为 ubuntu 设计的]

  1. 以 root 用户身份登录到您的服务器

  2. 使用以下命令停止服务器(用于 nginx)

    service nginx stop

  3. 然后更新您的证书

    certbot renew

  4. 启动你的服务器

    service nginx start

[提示]要查看续订证书的到期日期,请输入以下命令

ssl-cert-check -c [Path_to_your_certificate]/fullchain.pem

例如

ssl-cert-check -c /etc/letsencrypt/live/[your_domain_name]/fullchain.pem

或者

ssl-cert-check -c /etc/letsencrypt/live/[your_domain_name]/cert.pem

如果您的服务器中尚未安装 ssl-cert-check,请使用安装它

apt install ssl-cert-check

注意:证书只有在未过期的情况下才能续订。如果过期了,你必须创建一个新的。

【讨论】:

  • 这对 nginx 和 nodejs 服务器很有用。
【解决方案5】:

这是因为您使用了 --standalone。该选项的目的是启动一个临时网络服务器,因为您没有运行一个。

下次使用 --webroot 方法,你就可以使用你已经运行的 nginx 服务器了。

【讨论】:

【解决方案6】:

NodeJS/PM2 用户

我将PM2 用于我的NodeJS 服务,在尝试更新证书时,我还收到“绑定到端口80 的问题:无法绑定到IPv4 或IPv6”。错误信息。

正如上面对Apache/Ngnix 的回答中提到的,停止我的服务然后尝试更新解决了这个问题。

pm2 stop all
sudo certbot renew
pm2 start all

【讨论】:

    【解决方案7】:

    首先你需要安装 NGiNX Let encrypt 插件(如果你使用 NGiNX):

    sudo apt install python-certbot-nginx
    

    然后就可以安全运行了:

    sudo certbot renew --nginx
    

    它会起作用的。

    注意:certbot 应该已经安装好了。

    【讨论】:

      【解决方案8】:

      借鉴@JKLIR 只需运行

      /etc/letsencrypt/letsencrypt-auto renew --apache >> /var/log/letsencrypt/renew.log
      

      续订 ssl 证书

      【讨论】:

        【解决方案9】:

        对于 ngnix

        sudo certbot renew --nginx
        

        【讨论】:

          【解决方案10】:

          如果您尝试以普通用户的身份执行certbot 命令,请使用may not have access to bind to port 80 and other lower ports。如果是这种情况,您可以通过以下方式授予 python 访问权限:

          1. 首先,看看能不能找到python 3+(根据需要调整)

            echo "$(readlink -f "$(which python3)")"
            
          2. 允许python以普通用户身份打开80端口(根据需要调整)

            sudo setcap CAP_NET_BIND_SERVICE=+eip "$(readlink -f "$(which python3)")"
            
          3. 重新运行失败的certbot 命令。

          重要提示:在 Ubuntu 18.04 上,Python 被称为 python3。根据操作系统和您获得 certbot 的方式,它可能被称为许多不同的东西。此命令会因操作系统而异

          警告:这些较低的端口受到限制是有充分理由的。 setcap 命令存在安全注意事项。你可以在这里阅读更多关于它们的信息:https://superuser.com/a/892391

          【讨论】:

            【解决方案11】:

            我使用 Nginx,需要先停止服务器,然后才能继续。然后我运行命令:

            $ sudo ./certbot-auto  certonly --standalone -d chaklader.ddns.net
            Saving debug log to /var/log/letsencrypt/letsencrypt.log
            Plugins selected: Authenticator standalone, Installer None
            Obtaining a new certificate
            Performing the following challenges:
            http-01 challenge for chaklader.ddns.net
            Waiting for verification...
            Cleaning up challenges
            Subscribe to the EFF mailing list (email: xxx.chakfffder@gmail.com).
            
            IMPORTANT NOTES:
             - Congratulations! Your certificate and chain have been saved at:
               /etc/letsencrypt/live/cdddddder.ddns.net/fullchain.pem
               Your key file has been saved at:
               /etc/letsencrypt/live/chaklader.ddns.net/privkey.pem
               Your cert will expire on 2045-01-10. To obtain a new or tweaked
               version of this certificate in the future, simply run certbot-auto
               again. To non-interactively renew *all* of your certificates, run
               "certbot-auto renew"
             - If you like Certbot, please consider supporting our work by:
            
               Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
               Donating to EFF:                    https://eff.org/donate-le
            

            【讨论】:

              【解决方案12】:

              当我在一个实例上运行两个网站(主机)时,我遇到了类似的问题。我停止了 Nginx,然后运行了sudo certbot certonly --standalone --preferred-challenges http -d domain.com -d www.domain.com。重启 Nginx 后一切正常。

              【讨论】:

                猜你喜欢
                • 2015-03-05
                • 1970-01-01
                • 2020-04-19
                • 2015-02-02
                • 2015-11-30
                • 1970-01-01
                • 2012-04-11
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多