获取Let‘s Encrypt https 证书并自动更新

参考官方文档
环境: CentOS/RHEL 7

1. 安装snap,如果已安装,确保是最新版

sudo snap install core; sudo snap refresh core

2. 删除 certbot-auto 以及任何 Certbot OS 安装包

根据你安装时使用的工具执行不同的命令

sudo apt-get remove certbot,
sudo dnf remove certbot
sudo yum remove certbot.

3. 安装 Certbot

sudo snap install --classic certbot

4. 准备 Certbot 命令

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

5. 执行获取 Let's Encrypt https 证书命令

// certbot certonly --nginx --nginx-server-root [nginx配置目录] -d [域名] -m [邮箱]
certbot certonly --nginx --nginx-server-root /etc/nginx/ -d mt.xxx.cn -m xxx@qq.com

6. 配置自动刷新证书

# 1. 打开定时任务配置
 crontab -e
# 2. 增加定时刷新的配置
30 3 * */2 * /usr/bin/certbot renew --post-hook "service nginx restart" --quiet >> /var/log/cerbot.log
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值