TECH NOTES / 部署与运维

Certbot 申请 HTTPS 证书

原笔记 2025-05-20 · 整理于 2026-10-05

使用 Certbot 的 DNS 验证申请证书,并查看证书有效期与续期条件。

生成证书

plain
certbot certonly -d "*.example.com" --manual --preferred-challenges dns --email you@example.com

查看过期时间

plain
certbot certificates

手动 DNS 验证需要按提示添加 TXT 记录。--manual 模式在没有配置认证脚本时不能自动续期,长期使用请接入 DNS 插件或认证钩子;参见 Certbot FAQ。

参考:

https://juejin.cn/post/7205839782381928508?searchId=20250520094403AE5CC0A18EAA40DDD61B

文章配图