1. acme.sh 常见命令#
# 查询所有命令
acme.sh -h
# acme.sh更改申请证书机构
acme.sh --set-default-ca --server letsencrypt
# http方式申请证书, lizicai.com域名, --webroot指定访问文件夹
acme.sh --issue -d lizicai.com --webroot /root/test/
# 手动dns申请证书
acme.sh --issue --dns -d lizicai.com
# 使用dns提供接口, 自动dns申请证书, 以阿里云为例
export Ali_Key="Ali_Key"
export Ali_Secret="Ali_Secret"
acme.sh --issue --dns dns_ali -d lizicai.com
# Cloudflare 为例
export CF_Key="你的Global API Key"
export CF_Email="注册Cloudflare邮箱"
acme.sh --issue --dns dns_cf -d \*.lizicai.com
# 检查并更新所有证书
acme.sh --cron
# 设置更新证书通知, 以钉钉 dingtalk通知为例
export DINGTALK_WEBHOOK='复制的Webhook'
export DINGTALK_KEYWORD=acme
acme.sh --set-notify --notify-hook dingtalk
# 设置通知级别
# --notify-level <0|1|2|3>
# Set the notification level: Default value is 2.
# 0: disabled, no notification will be sent. 没有通知
# 1: send notifications only when there is an error. 有错误时才通知
# 2: send notifications when a cert is successfully renewed, or there is an error. 证书更新成功或错误才通知.
# 3: send notifications when a cert is skipped, renewed, or error. 跳过证书, 更新证书, 错误都有通知.
export NOTIFY_LEVEL='3'
# 设置acme.sh 自动升级
acme.sh --upgrade --auto-upgrade 1
# 卸载acme.sh, 并删除所有acme.sh添加crontab任务.
acme.sh --uninstall
# 证书key和fullchain另存, 在获取证书时一起使用
--key-file /root/cert/lizicai.com/private.key
--fullchain-file /root/cert/lizicai.com/fullchain.pem
# 获取证书时使用, 可执行的一些命令
--reloadcmd "/usr/sbin/nginx -s reload"
# 重新获取证书, 获取证书时使用
-r, --renew
# 强制
-f