利用acme.sh 的DNS API手动安装letsencrypt免费SSL证书

2.24K 浏览技术资料
0

letsencrypt免费SSL证书安装时常用的验证方式是Web,但是Web有时经常会出现各种问题,比如80端口没有开,比如你启用了CDN后letsencrypt无法获取你的域名的真实IP地址,这些经常会导致letsencrypt免费SSL证书签发的失败。

利用acme.sh的DNS API验证域名的方式就可以很好避免这些问题,而且还支持泛域名letsencrypt证书的申请与签发。这里以DNSPOD为例:

curl  https://get.acme.sh | sh -s [email protected]
#导入DNSPOD的API
export DP_Id="qimm"
export DP_Key="a7xxxxx"
#多域名
acme.sh   --issue   --dns dns_dp   -d pan.wzfou.com  -d mi.wzfou.com
#单域名
acme.sh   --issue   --dns dns_dp   -d pan.wzfou.com
#开始安装
acme.sh --install-cert -d pan.wzfou.com \
--key-file       /usr/local/nginx/conf/ssl/pan.wzfou.com.key  \
--fullchain-file /usr/local/nginx/conf/ssl/pan.wzfou.com.crt \
--reloadcmd     "service nginx force-reload"
 acme.sh --install-cert -d mi.wzfou.com \
--key-file       /usr/local/nginx/conf/ssl/mi.wzfou.com.key  \
--fullchain-file /usr/local/nginx/conf/ssl/mi.wzfou.com.crt \
--reloadcmd     "service nginx force-reload"

完成以上操作后,letsencrypt免费SSL证书以后每次续期时就会自动执行以上命令了,而且acme.sh安装时已经自动添加了定时任务,必要时你也可以手动添加定时任务或者手动续期:

31 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null

更多的方法请参考:https://wzfou.com/letsencrypt/


分享到:
聂素馨 已回答的问题 2021年12月17日
添加评论
0

我也是oneinstack。到时候看看会不会出问题。不过我用的CF的解析,我得找找怎么用API


分享到:
Qi 发表新评论 2021年12月20日
Avatar for 聂素馨

好像cf官网有api

添加评论
您正在查看3个答案中的1个,单击此处查看所有答案。
写下您的答案。

Login

Welcome! Login in to your account

Remember me Lost your password?

Don't have account. Register

Lost Password

Register