人生若只如初见

简单3步完成ssl泛证书的申请

2020-03-24 18

使用acme.sh脚本,完成ssl证书申请,并自动续期

准备工作

安装acme.sh

一行命令搞定: curl https://get.acme.sh | sh

准备域名解析服务商的API

acme.sh支持近100种域名服务商的API,具体详情可看附录,API一般是key+secret形式

开始申请

本例以阿里云解析为例

export Ali_Key="阿里的key"
export Ali_Secret="阿里的secret"
export DOMAIN="domain.com"  #修改为你的域名

~/.acme.sh/acme.sh --issue -d $DOMAIN -d *.$DOMAIN --dns dns_ali

使用证书

申请好的证书在 ~/.acme.sh/$DOMAIN目录下,直接使用即可,也可使用acme.sh的命令,具体使用方法可以看说明

~/.acme.sh/acme.sh  --installcert  -d $DOMAIN \
        --key-file   /etc/nginx/ssl/$DOMAIN.key \
        --fullchain-file /etc/nginx/ssl/fullchain.cer \
        --reloadcmd  "service nginx force-reload"

附录

acme.sh中文使用说明

acme.sh支持的DNS服务商

0 0