使用certbot自动申请和更新泛域名证书

0
(0)

安装 certbot

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

非泛域名的情况简单处理

如果是本地的nginx,且申请的不是泛域名证书的话,在nginx上配置了servername 后,可以直接用下面的命令使用向导进行证书申请和自动配置:

sudo certbot run --nginx

泛域名的需要DNS验证

大致流程如下:

1、安装好 certbot ,安装对应的 DNS 供应商的 plugins (这里以cloudflare举例子,如果是其他服务商的 plugins 见最后)


sudo snap set certbot trust-plugin-with-root=ok
sudo snap install certbot-dns-cloudflare

2、假如需要申请 泛域名证书,且域名由cloudflare管理,命令如下:

sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/cloudflare_token --dns-cloudflare-propagation-seconds 60 -d z1z.link -d '*.z1z.link'

3、上面的 `~/cloudflare_token` 文件内容大致如下,里面有 账号的用户名和token,需要根据自己的实际情况填写自己的

dns_cloudflare_email = xxxxx@qq.com
dns_cloudflare_api_key = 2312123132123132123132123132

其他 plugins:

certbot-dns-cloudflare
certbot-dns-digitalocean
certbot-dns-dnsimple
certbot-dns-dnsmadeeasy
certbot-dns-gehirn
certbot-dns-google
certbot-dns-linode
certbot-dns-luadns
certbot-dns-nsone
certbot-dns-ovh
certbot-dns-rfc2136
certbot-dns-route53
certbot-dns-sakuracloud

4、测试一下自动更新证书

sudo certbot renew --dry-run

这篇文章有用吗?

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位评论此文章。

很抱歉,这篇文章对您没有用!

让我们改善这篇文章!

告诉我们我们如何改善这篇文章?