申请Let's Encrypt的证书
允許EPEL倉(cāng)庫
$ yum -y install yum-utils $ yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional 安裝CertBot $ sudo yum install certbotcertbot需要pyOpenSSL 0.14版本
pip show pyOpenSSL查看版本, centos 7.2默認(rèn)安裝的pyOpenSSL0.13, 運(yùn)行certbot會(huì)報(bào)錯(cuò)
pip install pyOpenSSL==0.14
certbot在申請(qǐng)證書過程中,會(huì)通過訪問待申請(qǐng)域名下面的.well-known/acme-challenge/*來驗(yàn)證服務(wù)是否可訪問,所以需要先配置一下nginx.
在 nginx.conf加入以下配置
location ^~ /.well-known/acme-challenge/ {default_type "text/plain";root /usr/local/nginx-1.10.1/html; }申請(qǐng)證書
參數(shù)說明
--webroot 使用webroot plugin
-w webserver的root,/usr/local/nginx-1.10.1/html這是我的nginx的webroot目錄
-d 指定域名,這里是panchan.net.cn, www.panchan.net.cn
生成的證書存放在/etc/letsencrypt/live/panchan.net.cn目錄下面。
自動(dòng)更新證書
Let's Encrypt申請(qǐng)的免費(fèi)證書90天會(huì)自動(dòng)過期,可以使用以下命令自動(dòng)續(xù)期
首先運(yùn)行certbot renew --dry-run, 測(cè)試是否可以自動(dòng)續(xù)期,如果返回正確,可以在cron或systemd中添加計(jì)劃任務(wù)certbot renew實(shí)現(xiàn)自動(dòng)續(xù)期。
參考資料
https://letsencrypt.org/
https://letsencrypt.org/docs/
https://certbot.eff.org/#centosrhel7-nginx
總結(jié)
以上是生活随笔為你收集整理的申请Let's Encrypt的证书的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Storm部署文档
- 下一篇: 如何看Cortex-M系列处理器差异与共