切换主题
🏗️ 部署模式
WuEasy Cert Server 支持多种灵活的部署模式,适应不同的使用场景和架构需求。
📋 部署模式概览
部署模式 | 服务端 | 客户端 | 适用场景 | 复杂度 |
---|---|---|---|---|
单机模式 | ✅ | ✅ (本地) | 单服务器 | ⭐ |
服务端模式 | ✅ | ❌ | 证书管理服务器 | ⭐⭐ |
客户端模式 | ❌ | ✅ | 证书使用服务器 | ⭐⭐ |
混合模式 | ✅ | ✅ (远程) | 复杂分布式环境 | ⭐⭐⭐ |
🏠 单机模式(本地模式)
特点
- 在单台服务器上同时运行服务端和客户端
- 客户端通过本地调用获取证书,无需网络通信
- 配置简单,适合小型项目和个人使用
配置示例
yaml
log:
level: info
# 启用服务端功能
cert_server:
enabled: true
port: 9897
acme:
environment: production
renewal_threshold: 30
domains:
- id: "web-cert"
domain: "example.com"
email: "admin@example.com"
challenge_type: "http-01"
enabled: true
# 启用客户端功能(本地模式)
cert_client:
enabled: true
server_url: "" # 留空启用本地模式
certificates:
- id: "web-cert"
cert_path: "/etc/ssl/certs/example.crt"
key_path: "/etc/ssl/private/example.key"
post_update_script: "/etc/scripts/reload-nginx.sh"
enabled: true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
工作流程
优势
- 简单配置:单个配置文件完成所有设置
- 高性能:无网络延迟,直接内存调用
- 安全性高:证书不经过网络传输
- 实时同步:证书申请完成后立即可用
适用场景
- 个人博客网站
- 小型企业官网
- 开发测试环境
- 边缘计算节点
🖥️ 服务端模式
特点
- 专门作为证书管理服务器
- 提供 HTTP API 接口
- 集中管理多个域名的证书
- 不配置客户端功能
配置示例
yaml
log:
level: info
# 仅启用服务端功能
cert_server:
enabled: true
port: 9897
tokens: # API 访问令牌
- "your_secure_token_here"
acme:
environment: production
renewal_threshold: 30
domains:
- id: "web-cert-001"
domain: "www.example.com"
email: "admin@example.com"
challenge_type: "http-01"
enabled: true
- id: "api-cert-001"
domain: "api.example.com"
domains:
- "api.example.com"
- "admin.example.com"
cert_name: "api-services"
email: "admin@example.com"
challenge_type: "dns-01"
dns_provider: "cloudflare"
dns_config:
api_token: "your_cloudflare_token"
enabled: true
- id: "wildcard-cert-001"
domain: "*.app.example.com"
domains:
- "*.app.example.com"
- "app.example.com"
cert_name: "app-wildcard"
email: "admin@example.com"
challenge_type: "dns-01"
dns_provider: "aliyun"
dns_config:
access_key: "your_aliyun_key"
secret_key: "your_aliyun_secret"
enabled: true
# 禁用客户端功能
cert_client:
enabled: false
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
优势
- 集中管理:统一管理所有证书
- 高可用:可以部署多个实例
- API 丰富:提供完整的管理接口
- 安全可控:Token 认证保护
适用场景
- 企业证书管理中心
- 多团队共享证书服务
- 云原生环境
- DevOps 平台
💻 客户端模式
特点
- 专门作为证书使用服务器
- 从远程服务端同步证书
- 不提供证书申请功能
- 专注于证书部署和更新
配置示例
yaml
log:
level: info
# 禁用服务端功能
cert_server:
enabled: false
# 仅启用客户端功能
cert_client:
enabled: true
server_url: "https://cert-server.example.com:9897"
token: "your_secure_token_here"
certificates:
- id: "web-cert-001"
cert_path: "/etc/nginx/ssl/web.crt"
key_path: "/etc/nginx/ssl/web.key"
post_update_script: "/etc/scripts/reload-nginx.sh"
post_update_working_dir: "/etc/nginx"
post_update_timeout: 30
enabled: true
- id: "api-cert-001"
cert_path: "/etc/ssl/certs/api.crt"
key_path: "/etc/ssl/private/api.key"
post_update_script: "/etc/scripts/restart-api.sh"
enabled: true
- id: "wildcard-cert-001"
cert_path: "/etc/ssl/certs/wildcard.crt"
key_path: "/etc/ssl/private/wildcard.key"
post_update_script: "/etc/scripts/reload-services.sh"
enabled: true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
同步机制
优势
- 专业分工:专注于证书部署
- 自动同步:定时检查和更新
- 智能备份:自动备份现有证书
- 脚本支持:证书更新后自动执行操作
适用场景
- Web 服务器(Nginx、Apache)
- 应用服务器
- 负载均衡器
- API 网关
🔄 混合模式
特点
- 同时运行服务端和客户端功能
- 既管理本地证书,又同步远程证书
- 适合复杂的分布式环境
- 最大化灵活性
配置示例
yaml
log:
level: info
# 启用服务端功能(管理本地证书)
cert_server:
enabled: true
port: 9897
tokens:
- "local_server_token"
acme:
environment: production
renewal_threshold: 30
domains:
# 本地管理的证书
- id: "local-web-cert"
domain: "local.example.com"
email: "admin@example.com"
challenge_type: "http-01"
enabled: true
# 启用客户端功能(同步远程证书)
cert_client:
enabled: true
server_url: "https://central-cert-server.example.com:9897"
token: "central_server_token"
certificates:
# 从中央服务器同步的证书
- id: "shared-wildcard-cert"
cert_path: "/etc/ssl/certs/shared.crt"
key_path: "/etc/ssl/private/shared.key"
post_update_script: "/etc/scripts/reload-shared-services.sh"
enabled: true
- id: "company-api-cert"
cert_path: "/etc/ssl/certs/api.crt"
key_path: "/etc/ssl/private/api.key"
post_update_script: "/etc/scripts/restart-api.sh"
enabled: true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
架构图
优势
- 最大灵活性:支持复杂的证书管理需求
- 混合管理:本地证书和远程证书并存
- 高可用性:多层冗余和备份
- 渐进迁移:支持逐步迁移到集中管理
适用场景
- 大型企业分支机构
- 多云环境部署
- 渐进式架构迁移
- 高可用性要求的环境
🔧 部署最佳实践
安全配置
yaml
# 使用强随机令牌
cert_server:
tokens:
- "$(openssl rand -hex 32)"
# 限制网络访问
# 在防火墙中只开放必要端口
1
2
3
4
5
6
7
2
3
4
5
6
7
监控和日志
yaml
log:
level: info # 生产环境使用 info
# level: debug # 调试时使用 debug
1
2
3
2
3
备份策略
bash
# 定期备份证书和配置
#!/bin/bash
backup_dir="/backup/cert-server/$(date +%Y%m%d)"
mkdir -p "$backup_dir"
# 备份证书
cp -r /opt/cert-server/certs "$backup_dir/"
# 备份账户信息
cp -r /opt/cert-server/accounts "$backup_dir/"
# 备份配置文件
cp /opt/cert-server/config.yaml "$backup_dir/"
# 压缩备份
tar -czf "$backup_dir.tar.gz" "$backup_dir"
rm -rf "$backup_dir"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
高可用部署
yaml
# 使用负载均衡器
# 部署多个服务端实例
# 共享证书存储(如 NFS)
1
2
3
2
3
📊 部署模式选择指南
决策流程
选择建议
- 小型项目:单机模式
- 中型企业:服务端 + 客户端模式
- 大型企业:混合模式
- 云原生:客户端模式(配合容器编排)
选择合适的部署模式是成功使用 WuEasy Cert Server 的关键。根据您的具体需求和架构选择最适合的模式,可以大大简化证书管理工作。