有勇气的牛排博客

ZeroSSL 免费证书申请与自动配置

有勇气的牛排 816 nginx 2025-01-06 22:55:38

ZeroSSL 免费证书申请与自动配置

1 前言

ZeroSSL 是一个提供免费的 SSL/TLS 证书的服务平台,旨在帮助用户实现网站加密和增强安全性。与 Let’s Encrypt 类似,ZeroSSL 通过自动化工具和简便的流程,使得 SSL 证书的申请、安装和续期变得更加容易。ZeroSSL 支持不同类型的证书,包括域名验证(DV)、组织验证(OV)和扩展验证(EV)证书。

官网:https://app.zerossl.com/dashboard/start

2 基础配置

2.1 注册 ZeroSSL

https://app.zerossl.com/signup

2.2 安装 acme.sh

mkdir /usr/local/ssl_gen cd /usr/local/ssl_gen

2.2.1 git方式安装

git clone --depth 1 https://github.com/acmesh-official/acme.sh.git cd acme.sh ./acme.sh --install -m <你的邮箱>

2.2.2 脚本

wget -O - https://get.acme.sh | sh -s email=<你的邮箱>

2.3 获取 EAB凭证

https://app.zerossl.com/developer

获取 EAB凭证

获取 EAB凭证结果

2.4 设置 ZeroSSL 的 EAB 信息

# 设置 ZeroSSL 的 EAB 信息 ./acme.sh --register-account -m couragesteak@gmail.com --server https://acme.zerossl.com/v2/DV90 \ --eab-kid "<Your Key Identifier>" \ --eab-hmac-key "<Your HMAC Key>"

设置 ZeroSSL 的 EAB 信息

3 切换默认CA

默认CA为ZeroSSL

./acme.sh --set-default-ca --server zerossl

4 签发新证书

签发的是泛域名证书

获取需要DNS添加的 TXT 记录

./acme.sh --issue --dns dns_manual -d couragesteak.com -d *.couragesteak.com

申请证书

./acme.sh --issue --dns dns_manual -d couragesteak.com -d *.couragesteak.com
./acme.sh --renew -d couragesteak.com -d *.couragesteak.com

签发完毕后,证书会保存在:/root/.acme.sh

acme生成ssl证书文件

5 安装新证书

5.1 自动配置

未测试,读者自行验证

acme.sh --install-cert -d couragesteak.com \ --key-file /cert/couragesteak.com.key \ --fullchain-file /cert/couragesteak.com.cer \ --reloadcmd "systemctl force-reload nginx.service"

也可以自己将证书放到需要的位置然后重启nginx。

5.2 手动Nginx配置

ssl_certificate /cert/couragesteak.com.cer; ssl_certificate_key /cert/couragesteak.com.key;

留言

专栏
文章
加入群聊