使用 Certbot 更新并统一多子域名 SSL 证书实践总结
在服务器上使用 HTTPS 是保证安全访问的必备措施,而 Let’s Encrypt 提供了免费的 SSL 证书,结合 Certbot 工具可以非常方便地申请和更新证书。在实际场景中,往往不仅需要为主域名配置证书,还要同时支持多个子域名,比如: python-replCopyEditwww.domain.com mail.domain.com app1.domain.com app2.domain.com … 以下是一次完整实践记录,总结关键步骤与注意事项。 💡 证书现状查看 首先查看现有证书及已包含的域名: bashCopyEditcertbot certificates 输出示例: yamlCopyEditFound the following certs: Certificate Name: domain.com Domains: domain.com mail.domain.com www.domain.com Expiry Date: 2025-09-22 21:50:18+00:00 (VALID: 82 days) Certificate Path: /etc/letsencrypt/live/domain.com/fullchain.pem Private Key Path: /etc/letsencrypt/live/domain.com/privkey.pem 🔄 重新申请并添加更多子域名 为了将所有需要的子域名统一到一个证书中,执行以下命令(使用 …