acme.sh 的安装方式有很多种,我为了后期迁移方便就使用 docker 来安装。
准备
安装 docker、docker-compose
创建数据存放目录以及 docker-compose 文件
1 2 3
| mkdir acme.sh cd acme.sh touch docker-compose.yml
|
docker-compose
1 2 3 4 5 6 7 8 9 10 11 12 13
| version: '3' services: acme.sh: image: neilpang/acme.sh:latest container_name: acme.sh restart: always network_mode: host volumes: - ./:/acme.sh - /data/certificate/:/certificate command: daemon environment: TZ: Asia/Shanghai
|
安装
测试
1
| docker exec acme.sh --version
|
设置邮箱
1
| echo "ACCOUNT_EMAIL='YOUR_EMAIL'" >> ./account.conf
|
获取DNSPod Token
1 2
| echo "SAVED_DP_Id='Id'" >> ./account.conf echo "SAVED_DP_Key='Token'" >> ./account.conf
|
获取Cloudflare Token
- 将获取到的三个值写入到
./account.conf
1 2 3
| echo "SAVED_CF_Token='令牌'" >> ./account.conf echo "SAVED_CF_Account_ID='账户ID'" >> ./account.conf echo "SAVED_CF_Zone_ID='区域ID'" >> ./account.conf
|
获取ZeroSSL API Key
- 登录 ZeroSSL 并访问 Developer 页面,点击生成
EAB Credentials
1
| docker exec acme.sh --register-account --server zerossl --eab-kid YOUR_EAB_KID --eab-hmac-key YOUR_EAB_HMAC_Key
|
生成证书
1 2
| docker exec acme.sh --issue -d domain.com -d *.domain.com --dns dns_dp -k ec-256 docker exec acme.sh --issue -d domain.com -d *.domain.com --dns dns_cf -k ec-256
|
安装证书
1
| docker exec acme.sh --install-cert -d domain.com -d *.domain.com --fullchain-file /certificate/domain.com.crt --key-file /certificate/domain.com.key --ecc --reloadcmd "自定义后续操作"
|