1、安装certbot
yum install certbot
2、获取证书
certbot certonly --standalone -d example.com -d www.example.com
查看证书路径:certbot certificates
3、自动更新SSL证书
# 手动更新:
certbot renew --dry-run
# 设置自动任务:
crontab -e
#每隔 两个月的 凌晨 2:15 执行 更新操作,更新需要使用--pre-hook临时关闭nginx
15 2 * */2 * certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"