安装
curl https://get.acme.sh | sh
#或者
wget -O - https://freessl.cn/api/get.acme.sh | sh
注册
acme.sh --register-account --accountemail 80150348@qq.com \
--server https://acme.freessl.cn/directory
自动 DNS API 集成
服务商名称 |
服务商简称 |
所需API参数 |
获取API参数地址 |
cloudxns |
cx |
export CX_Key="123456" export CX_Secret="abcdef" |
点击访问 |
dnspod (cn大陆版) |
dp |
export DP_Id="123456" export DP_Key="abcdef" |
点击访问 |
aliyun |
ali |
export Ali_Key="123456" export Ali_Secret="abcdef" |
点击访问 |
cloudflare |
cf |
export CF_Key="123456" export CF_Email="abc@example.com" |
点击访问 |
linode |
linode |
export LINODE_API_KEY="123456" |
点击访问 |
he |
he |
export HE_Username="username" export HE_Password="password" |
he的用户名密码 |
digitalocean |
dgon |
export DO_API_KEY="123456" |
点击访问 |
namesilo |
namesilo |
export Namesilo_Key="123456" |
点击访问 |
aws |
aws |
export AWS_ACCESS_KEY_ID=123456 export AWS_SECRET_ACCESS_KEY=abcdef |
点击访问 |
namecom |
namecom |
export Namecom_Username="username" export Namecom_Token="123456" |
点击访问 |
freedns |
freedns |
export FREEDNS_User="username" export FREEDNS_Password="password" |
freedns的用户名密码 |
godaddy |
gd |
export GD_Key="123456" export GD_Secret="abcdef" |
点击访问 |
yandex |
yandex |
export PDD_Token="abcdef" |
点击访问 |
部署
#一键申请证书
./acme.sh --issue --dns dns_ali -d *.haokaikai.cn
#将证书部署到nginx
./acme.sh --install-cert -d *.haokaikai.cn \
--key-file /data/ssl/haokaikai.cn/privkey.pem \
--fullchain-file /data/ssl/haokaikai.cn/fullchain.pem \
--reloadcmd "/bin/systemctl restart nginx.service"
#实现全自动
./acme.sh --force --issue --dns dns_ali \
-d *.haokaikai.cn \
--renew-hook "acme.sh \
--install-cert -d haokaikai.cn \
--key-file /data/ssl/haokaikai.cn/privkey.pem \
--fullchain-file /data/ssl/haokaikai.cn/fullchain.pem \
--reloadcmd \"/bin/systemctl restart nginx.service\""
- 当我们的证书颁发完成之后,acme.sh 脚本会每天去检查它所管理的证书是否即将到期(过期前30天),此时,它将通过你上次申请该证书的方式重新申请证书。如果你也添加了 --renew-hook,从此就不管用管证书的是否到期了
卸载
./acme.sh --uninstall
共有 0 条评论