菜单

怎么办
发布于 2025-06-30 / 28 阅读
0
0

nginx ssl证书自动续签(linux)

1.安装软件

yum install certbot python-certbot-nginx

2.申请证书并自动配置Nginx

certbot --nginx -d yourdomain.com

3.设置自动续期(每月1日执行)

0 0 1 * * certbot renew --quiet --renew-hook 'systemctl reload nginx'

具体设置方法

$ which certbot  # 查找cerbot具体设置路径
$ /usr/bin/certbot
# 2. 编辑 Cron 任务
$ sudo crontab -e
# 3. 添加以下内容并保存
0 0 1 * * /usr/bin/certbot renew --quiet --renew-hook 'systemctl reload nginx'
# 4. 查看任务是否添加成功
$ sudo crontab -l


评论