certbot命令总结:
安装:
yum install -y epel-release
yum install -y certbot
申请证书:
certbot certonly --webroot -w /usr/local/nginx/html_80 -d 你的网页的域名 -m 你的邮箱地址 --agree-tos
查看证书有效期
openssl x509 -noout -dates -in /etc/letsencrypt/live/你的网页域名/cert.pem
人工更新证书:
certbot renew --dry-run
certbot renew --quiet # 如果不需要返回的信息,可以用静默方式
自动更新证书:
可以使用crontab定时更新,例如:
crontab -e
然后增加下列内容:
00 05 01 * * /usr/bin/certbot renew --quiet && /bin/systemctl restart nginx
# 每月1号5时执行执行一次更新,并重启nginx服务器