下面从概念 → 常见场景 → 配置示例 → 运维注意点给你一套可落地的 SSL 证书链运维配置指南。
一个完整的 SSL/TLS 证书通常包含:
服务器证书(Leaf / End-Entity)
↓ 由
中间证书(Intermediate CA)
↓ 由
根证书(Root CA)
✅ 客户端只信任 Root
✅ 服务器必须发送:服务器证书 + 中间证书
❌ 不发送中间证书 = 证书链不完整 = 部分客户端报错
正确顺序(从服务器证书开始):
-----BEGIN CERTIFICATE-----
服务器证书
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
中间证书1
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
中间证书2(如有)
-----END CERTIFICATE-----
合并证书链
cat domain.crt intermediate.crt > fullchain.crt
nginx.conf
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/nginx/ssl/fullchain.crt;
ssl_certificate_key /etc/nginx/ssl/domain.key;
ssl_protocols TLSv1.2 TLSv1.3;
}
✅ 推荐用:
fullchain.pem(证书 + 中间)privkey.pem<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /path/domain.crt
SSLCertificateKeyFile /path/domain.key
SSLCertificateChainFile /path/intermediate.crt
</VirtualHost>
⚠️ 新版本 Apache 推荐:
SSLCertificateFile /path/fullchain.crt
server:
ssl:
key-store: classpath:keystore.p12
key-store-password: xxx
key-store-type: PKCS12
✅ keystore 中必须包含:
tls:
- hosts:
- example.com
secretName: tls-secret
kubectl create secret tls tls-secret \
--cert=fullchain.crt \
--key=domain.key
openssl verify -CAfile root.crt fullchain.crt
openssl s_client -connect example.com:443 -servername example.com
重点看:
Verify return code: 0 (ok)| 问题 | 原因 | 解决 |
|---|---|---|
| 手机/旧系统报错 | 缺中间证书 | 补全 chain |
| Let’s Encrypt 报错 | 用了 cert.pem 而非 fullchain.pem | 换 fullchain |
| 更新证书后不生效 | 没 reload | nginx -s reload |
| 多域名/DV/OV混用 | 中间证书混了 | 用对应 CA 的 chain |
如果你能告诉我:
我可以直接帮你写对应环境的完整配置模板。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。