acme.sh签发Let's Encrypt证书

1.安装acme.sh

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

 2.手动 dns 方式, 手动在域名上添加一条 txt 解析记录, 验证域名所有权

这种方式的好处是, 你不需要任何服务器, 不需要任何公网 ip, 只需要 dns 的解析记录即可完成验证. 坏处是,如果不同时配置 Automatic DNS API,使用这种方式 acme.sh 将无法自动更新证书,每次都需要手动再次重新解析验证域名所有权。

acme.sh --issue --dns -d mgcr.megoai.com

acme.sh --issue -d mgcr.megoai.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please

3.在域名解析这边加一条TXT解析记录 

然后, acme.sh 会生成相应的解析记录显示出来, 你只需要在你的域名管理面板中添加这条 txt 记录即可.

4.等待解析完成之后, 重新生成证书:

acme.sh --renew -d mgcr.megoai.com

acme.sh --renew -d mgcr.megoai.com --force --yes-I-know-dns-manual-mode-enough-go-ahead-pleas 

注意第二次这里用的是 --renew

dns 方式的真正强大之处在于可以使用域名解析商提供的 api 自动添加 txt 记录完成验证.

acme.sh 目前支持 cloudflare, dnspod, cloudxns, godaddy 以及 ovh 等数十种解析商的自动集成.

以 dnspod 为例, 你需要先登录到 dnspod 账号, 生成你的 api id 和 api key, 都是免费的. 然后:

5.查看证书的有效期

acme.sh --list

注意:这里生成的证书路径是被隐藏了

6.安装证书

acme.sh --install-cert -d mgcr.megoai.com --key-file   /etc/nginx/ssl/mgcr.megoai.com/mgcr.megoai.key --fullchain-file /etc/nginx/ssl/mgcr.megoai.com/fullchain.cer  --reloadcmd  "service nginx force-reload"

7.nginx新增443监听

nginx配置:

8.最后重启一下nginx

nginx -s reload

9.最最最后,就是要在Azure开发443端口

看到最后的盆友,麻烦帮忙点一下,谢谢。

参考:https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E

发布了149 篇原创文章 · 获赞 28 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/u011442726/article/details/105557060
今日推荐