letsencrypt 单域名(不是泛域名)申请及自动续期
- 官方参考:https://certbot.eff.org/docs/using.html#webroot
- 不是泛域名(*.a.b),泛域名参考我之前的一篇文章:https://blog.csdn.net/phenhorlin2/article/details/85940861
- 申请
certbot certonly --webroot -w /var/www/example -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net
e.g:
certbot certonly --webroot -w /opt/svr/yctracker -d tracker.ycnit.com
其中
/opt/svr/yctracker
为 web 根目录, certbot 会在这个目录下生成一个特殊的文件,然后通过域名 tracker.ycnit.com 去访问这个文件,能访问到就 验证通过。
所以需要先用nginx 设置一个80端口 vhost 根web目录指定到这个目录
- 更新(续期)
官方文档:https://certbot.eff.org/docs/using.html#renewing-certificates
certbot renew --deploy-hook /path/to/deploy-hook-script
- 强制更新
添加参数
--force-renewal
certbot renew --force-renewal --deploy-hook "/usr/bin/systemctl restart nginx"
- 原有的证书上添加新域名
官方文档:
https://certbot.eff.org/docs/using.html#re-creating-and-updating-existing-certificates
certbot --expand -d existing.com,example.com,newdomain.com