暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

使用Let's Encrypt申请泛域名证书

哥哥的激光炮 2020-06-13
381

使用Let's Encrypt申请泛域名证书

使用acme.sh脚本,完成Let's Encrypt证书申请,90天后续期等操作。github地址:https://github.com/acmesh-official/acme.sh



1. 安装acme.sh

  1. curl https://get.acme.sh | sh


2. 给acme.sh 别名,方便使用

  1. ~/.acme.sh/


3. 设置acme.sh自动升级

  1. acme.sh --upgrade --auto-upgrade


4. 使用dns模式,获取TXT

  1. acme.sh --issue -d *.example.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please

5. 将上面得到TXT记录,填入域名解析


6. 验证TXT解析是否生效

  1. dig -t txt _acme-challenge.example.com @8.8.8.8


7. TXT解析生效后,生成证书

  1. acme.sh --force --renew -d *.example.com --yes-I-know-dns-manual-mode-enough-go-ahead-please


8. 根据域名提供商的API完成证书申请

以阿里万网域名为例,获取AccessKey ID与AccessKey Secret

  1. export Ali_Key=""

  2. export Ali_Secret=""

  3. acme.sh --issue -d *.example.com --dns dns_ali --force


9. 将证书放在需要的位置,默认位于 ~/.acme.sh/example.com

使用acme.sh --installcert 来指定目标文件. 并且可以指定 reloadcmd, 当证书更新以后, reloadcmd会被自动调用,让服务器生效.

  1. acme.sh --installcert -d *.example.com \

  2. --key-file /etc/pki/nginx/private/server.key \

  3. --fullchain-file /etc/pki/nginx/server.crt \

  4. --reloadcmd "service nginx force-reload"


10. 成功!


文章转载自哥哥的激光炮,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论