使用 certbot 生成通配符 HTTPS 证书

问题描述 投票:0回答:3

如何生成通配符 HTTPS 证书?

server {
    server_name subdomain.domain.com www.subdomain.domain.com *.subdomain.domain.com  ~^(.*)\.subdomain\.domain\.com$;
}

目前,对于普通域,我生成如下证书:

sudo certbot --nginx -d example.com
nginx devops lets-encrypt
3个回答
1
投票

对于通配符,只需使用

*

添加另一个条目
sudo certbot --nginx -d *.example.com -d example.com

您可以进一步参考此处Let's Encrypt:使用 Certbot 的通配符证书


1
投票

我使用以下方法生成通配符证书,它的效果非常好。在这里,我们正在进行 dns 挑战,因此您应该有权访问您的 dns 来创建将在创建证书时读取的条目。

sudo certbot certonly --manual   -d *.example.com   -d example.com \ 
--email [email protected]   --agree-tos \ 
--preferred-challenges dns-01 \ 
--server https://acme-v02.api.letsencrypt.org/directory

希望这些信息对您有帮助


0
投票

使用您的命令,您将通过 HTTP-Challenge 颁发证书。 Let's Encrypt 不支持通过 HTTP-Challenge 颁发通配符证书。

以下是有关 Let's Encrypt 支持的质询类型的链接: https://letsencrypt.org/docs/challenge-types/

对于通配符证书,您需要通过 DNS 挑战颁发证书。因此,您需要对托管提供商或动态 DNS 提供商进行 API 访问。 Certbot 为其中一些提供了一些插件,这里是 Certbot-DNS-Plugins-Site 的链接:https://certbot.eff.org/docs/using.html#dns-plugins

如果您的提供商未列出,您将无法使用 Certbot 颁发通配符证书。还有一些其他工具支持 Let's Encrypt 的 DNS 挑战,例如 acme.sh,这里是 Github 存储库的链接:https://github.com/acmesh-official/acme.sh

我希望我能帮助您了解这些信息。

巴纳宁国王

© www.soinside.com 2019 - 2024. All rights reserved.