安装certbot
CentOS
yum install -y certbot
如果提示No package certbot available.
的话,先安装EPEL源再安装
yum install -y epel-release
yum install -y certbot
Ubuntu/Debian
sudo apt install -y certbot
安装certbot-dns-dnspod
使用pip安装,需要先安装python跟pip
pip install certbot-dns-dnspod

配置DNSPod Token
Token申请地址:https://console.dnspod.cn/account/token/token
配置dnspod token信息
dnspod的token配置格式是 id,token
创建配置文件,保存在/etc/certbot/
目录下
假设我的id是123456
,token是9d9aee10be45ce79417b22b5c906bd33
mkdir /etc/certbot
echo '
dns_dnspod_email = "web@notevm.com"
dns_dnspod_api_token = "123456,9d9aee10be45ce79417b22b5c906bd33"
'>/etc/certbot/dnspod.ini

查看配置文件
cat /etc/certbot/dnspod.ini

设置配置文件权限
chmod 600 /etc/certbot/dnspod.ini
申请证书
certbot certonly \
-a dns-dnspod \
--dns-dnspod-credentials /etc/certbot/dnspod.ini \
-d notevm.com \
-d *.notevm.com

第一次申请填写几个参数(邮箱、是否同意条款、是否接收资讯邮件)就行。
证书申请后保存在/etc/letsencrypt/live/域名/
目录下。
设置自动续期
使用crontab任务计划来实现自动续期
关于crontab用法可以查看这篇文章:Linux任务计划crontab用法
执行crontab -e
0 3 */8 * * /bin/certbot renew
30 3 */8 * * /bin/nginx -s reload

保存后重启crond服务
systemctl restart crond
每隔8天凌晨3点整执行证书续签指令
每隔8天凌晨3点30分重启nginx
原创文章,作者:小哆啦,如若转载,请注明出处:https://www.notevm.com/a/5738.html
评论列表(2条)
我都是用acme.sh申请SSL的!
@运维学习笔记博客:我是一直以来都是使用的certbot申请证书,习惯了。