使用 Certbot 申請 Let's Encrypt SSL 證書,並定時續期


網站有個 SSL 證書,可以提高安全性、及提高搜索引擎的排名。
Let’s Encrypt SSL 證書是免費的,可以用命令行申請,也可以用命令行續期。

Let’s Encrypt 網站推薦用 cerbot 工具。這個工具軟件在不同的年份,有不同的用法(可能是不同軟件版本的命令行,參數與之前版本改動較大),網上查到的往往行不通。這篇文章介紹當前版本可用的命令行參數使用方法。

 

參考網站:
https://letsencrypt.org/zh-cn/
https://certbot.eff.org/instructions

a. 申請有通配符的域名 SSL 證書:

certbot certonly -d *.somedomain.com --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory

 


根據提示,輸入對應的信息。生成證書后,可更改 nginx/apache 對應的配置文件。

 

b. 定時運行命令,續期 SSL 證書:

certbot certonly -d *.somedomain.com --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory

 


命令與前一步一樣。得到的提示不同,如下:

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Keep the existing certificate for now
2: Renew & replace the certificate (may be subject to CA rate limits)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

選擇 2,進行 SSL 證書續期。續期后的證書,是覆蓋原有的。

 

-------此博客同時發表於 https://my.oschina.net/jacklondon,https://www.cnblogs.com/jacklondon,https://www.zheguisoft.com/staff_blogs/jacklondon_chen/2022 ,歡迎轉載。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM