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