安装

curl https://get.acme.sh | sh -s email=my@example.com # 注意自己替换邮箱,可以随便输入
source ~/.bashrc

国内服务器安装

git clone https://gitee.com/neilpang/acme.sh.git
cd acme.sh
./acme.sh --install -m my@example.com

开启自动更新

acme.sh --upgrade --auto-upgrade

手动切换 SSL CA

切换 Let’s Encrypt

acme.sh --set-default-ca --server letsencrypt

生成证书

如果你用的 apache服务器

acme.sh --issue -d mydomain.com --apache

如果你用的 nginx服务器

acme.sh --issue -d mydomain.com --nginx

如果你还没有运行任何 web 服务, 80 端口是空闲的, 那么 acme.sh 还能假装自己是一个webserver, 临时听在80 端口, 完成验证

acme.sh --issue -d mydomain.com --standalone

如果你不是标准的 80 端口,可以执行端口

acme.sh --issue  -d mydomain.com  --standalone --httpport 88

运行成功后会生成如下文件:

mydomain.com.cer  # 域名的公钥 Certificate File
mydomain.com.key  # 域名的私钥 Private Key File (切勿泄露私钥)
ca.cer            # 中间 CA 证书 Intermediate CA Certificate 中间 CA 证书是将您的证书(为您的域签发的证书)与 CA 根证书连接起来的证书
fullchain.cer     # 全链证书 Full Chain Certificates 包含域名证书和中间 CA 证书的组合

本文参考:
acme 中文说明
Install in China
How to issue a cert
acme.sh手动切换SSL CA

标签: none

评论已关闭