【问题标题】:Fix so Let's Encrypt works with www修复,让 Let's Encrypt 与 www 一起使用
【发布时间】:2020-06-30 18:56:44
【问题描述】:

Firefox 不信任此站点,因为它使用的证书对www.example.com 无效。证书仅对 example.com 有效。

错误代码:SSL_ERROR_BAD_CERT_DOMAIN

我在 Ubuntu 16、Apache httpd 上使用 Let's Encrypt。

如何添加才能使其也适用于 www?我猜是 Apache 中的一些 conf?

找不到任何关于它的信息。

【问题讨论】:

    标签: apache ubuntu lets-encrypt


    【解决方案1】:

    假设您已经安装了certbot (docs for your version of Ubuntu and Apache),您应该使用-d 命令行开关列出您希望证书适用的域。 From the docs:

     -d DOMAIN, --domains DOMAIN, --domain DOMAIN
                       Domain names to apply. For multiple domains you can
                       use multiple -d flags or enter a comma separated list
                       of domains as a parameter. The first domain provided
                       will be the subject CN of the certificate, and all
                       domains will be Subject Alternative Names on the
                       certificate. The first domain will also be used in
                       ...
    

    如果您想进行空运行测试,请使用certonly--dry-run(您必须以rootsudo 运行):

    certbot certonly --dry-run -d www.example.com -d example.com
    

    如果看起来一切正常,实际生成、安装和激活证书(注意这将重新启动 Apache):

    certbot --apache -d www.example.com -d example.com
    

    certbot 将为您对 Apache 配置进行必要的编辑。

    如果您希望手动进行编辑,请使用webroot 选项。 The docs for that option 包括对多个域执行此操作的示例,包括 example.com 和 www.example.com。从该示例中删除其他域以简化这种情况:

    certbot certonly --webroot -w /var/www/example -d www.example.com -d example.com
    

    您需要自己重新启动 Apache 才能在使用此选项时使用新证书。

    【讨论】:

    • 谢谢。我今晚试试。我同意它是否有效。
    • @Joe 过得怎么样?
    • @Joe,Joe,Joe 你在哪里!? :-) 浪费一半的赏金似乎太可惜了……为什么?
    • 该死的。我忘了。对不起!完美运行。
    猜你喜欢
    • 2016-12-06
    • 2021-05-06
    • 2017-01-18
    • 2020-12-31
    • 2017-06-05
    • 2018-04-23
    • 1970-01-01
    • 2017-11-20
    • 2017-02-18
    相关资源
    最近更新 更多