利用 acme.sh 为网站提供 ssl 支持
原先用 Certbot 为网站安装证书时Nignx配置文件会被 Certbot 自动修改,令配置文件内容凌乱不堪,而且还要额外安装 Snap 影响服务器运行效率。所以放弃了 Certbot ,改用 acme.sh 生成和安装证书。 其安装和使用步骤如下: 安装 acme.sh curl https://get.acme.sh | sh -s email=my@example.com # my@example.com 修改为你自己的 E-mail 地址 alias acme.sh=~/.acme.sh/acme.sh # 创建一个 shell 的 alias 方便使用 生成证书(手动 DNS 方式) acme.sh --issue --dns -d sixdian.com -d *.sixdian.com --keylength ec-256 \ --yes-I-know-dns-manual-mode-enough-go-ahead-please acme.sh 会生成相应的解析记录显示出来,然后在你的域名管理面板中添加这些 txt 记录。 解析完成之后,重新生成证书 acme.sh --renew -d sixdian.com -d *.sixdian.com --ecc\ --yes-I-know-dns-manual-mode-enough-go-ahead-please 获取 cloudflare API key 地址:https://dash.cloudflare.com/profile/api-tokens export CF_Key="Global API Key" # Global API Key 修改为你的 Cloudflare API 密钥 export CF_Email="my@example.com" # my@example.com 修改为你 Cloudflare 账户绑定的邮箱 acme.sh --issue -d sixdian.com -d *.sixdian.com --dns dns_cf --ecc # 申请证书 安装证书(以 Nginx 为例) acme.sh --install-cert -d sixdian.com -d *.sixdian.com \ --key-file /home/sixdian/ssl/key.pem \ --fullchain-file /home/sixdian/ssl/cert.pem \ --reloadcmd "service nginx force-reload" 开启 acme.sh 自动升级 acme.sh --upgrade --auto-upgrade