【问题标题】:How to renew only one domain with certbot?如何使用 certbot 只更新一个域?
【发布时间】:2017-07-24 06:55:49
【问题描述】:

我有多个具有多个证书的域:

$ ll /etc/letsencrypt/live/
> domain1.com
> domain2.com
> domain3.com
> ...

我只需要更新domain1.com,但命令certbot renew 更新所有域的证书。如何明确更新某些证书?

【问题讨论】:

    标签: lets-encrypt certbot


    【解决方案1】:

    使用带有--cert-name 选项的renew 续订单个证书。

    certonly为一个或多个域创建证书,如果存在则替换它)。

    示例

    certbot renew --cert-name domain1.com --dry-run
    

    删除--dry-run 以实际续订。


    证书名称 != 域名

    请注意,提供给 --cert-name 选项的值是证书名称(不是域名),使用

    certbot certificates
    

    返回一个类似的列表

    -------------------------------------------------------------------------------
    Found the following certs:
      Certificate Name: myfundomains.com
        Domains: myfundomains.com
        Expiry Date: 2018-05-04 04:28:05+00:00 (VALID: 67 days)
        Certificate Path: /etc/letsencrypt/live/myfundomains.com/fullchain.pem
        Private Key Path: /etc/letsencrypt/live/myfundomains.com/privkey.pem
      Certificate Name: ask.myfundomain.com
        Domains: ask.myfundomain.com
        Expiry Date: 2018-03-13 18:59:40+00:00 (VALID: 16 days)
        Certificate Path: /etc/letsencrypt/live/ask.myfundomain.com/fullchain.pem
        Private Key Path: /etc/letsencrypt/live/ask.myfundomain.com/privkey.pem
      Certificate Name: forums.myfundomain.com
        Domains: forums.myfundomain.com forum.myfundomain.com
        Expiry Date: 2018-04-11 16:39:18+00:00 (VALID: 45 days)
        Certificate Path: /etc/letsencrypt/live/forums.myfundomain.com/fullchain.pem
        Private Key Path: /etc/letsencrypt/live/forums.myfundomain.com/privkey.pem
    -------------------------------------------------------------------------------
    

    注意第三个证书名称 (forums.myfundomain.com) 如何包含多个域

    • forums.myfundomains.com
    • forum.myfundomas.com

    重启 Apache/nginx

    -------------------------------------------------------------------------------
    new certificate deployed without reload, fullchain is
    /etc/letsencrypt/live/ask.myfundomain.com/fullchain.pem
    -------------------------------------------------------------------------------
    

    记得重新启动您的网络服务器以使用新证书。

    【讨论】:

    • 是的,这个方法在你使用nginx的自定义构建时非常有用。
    • 谢谢!在(示例)www.domain.nl 和 domain.nl 上为我工作如下(只有一个命令): certbot renew -n --cert-name www.domain.nl --force-renewal
    【解决方案2】:

    您可以使用此命令(用于 Apache 服务器):

    certbot --apache certonly -n -d domain1.com
    
    • --apache 用于 apache 服务器,使用 --nginx 标志用于 nginx 服务器
    • -n 选项在不提示的情况下执行命令
    • -d domain1.com 仅对 domain1.com 执行

    您可以使用--dry-run 进行测试,您可以使用--pre-hook--post-hookcertbot renew 一样

    来源:https://certbot.eff.org/docs/using.html#renewing-certificates

    【讨论】:

    • 您的回答也对我使用 nginx 有所帮助。请也添加nginx服务器--nginx
    猜你喜欢
    • 2018-08-05
    • 2019-09-10
    • 2020-04-04
    • 2018-08-06
    • 2021-06-12
    • 1970-01-01
    • 2017-07-07
    • 2020-08-24
    • 2012-07-01
    相关资源
    最近更新 更多