certbot命令申请免费的SSL证书并自动续期
申请证书
安装snap命令(大部分系统自带无需安装)
sudo apt-get install snapd
确保snap版本是最新的
sudo snap install core; sudo snap refresh core
删除Certbot -auto和任何Certbot操作系统包(如果安装了任何Certbot包)
sudo apt-get remove certbot
安装Certbot
sudo snap install --classic certbot
创建certbot软连接
sudo ln -s /snap/bin/certbot /usr/bin/certbot
申请证书
1 |
|
命令说明
1 |
|
自动续期证书
系统上的Certbot包附带一个cron作业和systemd计时器
检查cron服务状态(保证服务处于运行状态)
1 |
|
创建并编辑用户任务(cron文件)
crontab -e
加入续期命令
1 |
|
重新加载服务
service cron reload
测试自动续期(如果使用–standalone申请证书确保80端口未被占用)
sudo certbot renew --dry-run
详细cron服务
Ubuntu定时任务Crontab
Certbot的官网
https://certbot.eff.org/
Certbot指南
https://eff-certbot.readthedocs.io/en/stable/using.html
certbot命令申请免费的SSL证书并自动续期
https://www.inktea.eu.org/2021/51846.html