安装acme.sh
curl https://get.acme.sh | sh
#如果不能用 国内
git clone https://gitee.com/neilpang/acme.sh.git
cd acme.sh
./acme.sh --install -m my@example.com
按dns解析
# https://github.com/acmesh-official/acme.sh/wiki/dnsapi 文档
# 1.手动添加dns
./acme.sh --issue --dns -d mydomain.com --yes-I-know-dns-manual-mode-enough-go-ahead-please
#然后, acme.sh 会生成相应的解析记录显示出来, 你只需要在你的域名管理面板中添加这条 txt 记录即可
./acme.sh --renew -d mydomain.com --yes-I-know-dns-manual-mode-enough-go-ahead-please
# 2.自动添加
# dnspod 为例 https://console.dnspod.cn/account/token/token ,其他服务商看文档
export DP_Id="1234"
export DP_Key="sADDsdasdgdsf"
./acme.sh --issue --dns dns_dp -d mydomain.com -d *.mydomain.com
导出
./acme.sh --install-cert -d mydomain.com
--cert-file '/home/ubuntu/certfile/cert.pem'#导出的路径
--key-file '/home/ubuntu/certfile/key.key'#导出的路径