SSL 证书自动续订

SSL 证书自动续订

之前一直用腾讯云的 SSL 证书管理,证书即将过期时手动去续订,随着免费证书从一年改成三个月,多个证书的手动续订变得更加繁琐,尝试了自动续订方案,并且配置成功,现在记录一下。

安装 acme.sh

将下面命令的 email 改成你的电子邮箱

curl https://get.acme.sh | sh -s email=my@example.com

配置 cloudflare token

去创建 token: https://dash.cloudflare.com/profile/api-tokens

CF_Account_ID 从仪表盘的 url 后面获取。

设置环境变量 vim ~/.bashrc

export CF_Token="sdfsdfsdfljlbjkljlkjsdfoiwje"
export CF_Account_ID="xxxx@example.com"

刷新 source ~/.bashrc

签发证书

acme.sh --issue --dns dns_cf -d example.com

安装证书

acme.sh --installcert -d example.com --keypath /etc/nginx/example.com.key --fullchainpath /etc/nginx/example.com.cer --reloadcmd 'systemctl reload nginx'

启用自动续订

acme.sh --renew -d example.com

查看域名配置

acme.sh --list -d example.com

阅读剩余
THE END