troubleshooting 2026-12-02 ⏱ 1 min read

修复 Certbot 续期错误

修复 Certbot 续期错误

Certbot 续期错误几乎总能归结到验证上:CA 无法访问你的服务器来确认域名控制权。先按需重现失败,再读准确的错误信息。

第 1 步:跑一次试运行并读日志

sudo certbot renew --dry-run
sudo tail -n 80 /var/log/letsencrypt/letsencrypt.log
sudo certbot certificates

试运行使用测试环境服务器,所以不计入生产速率限制。日志里有验证地址和失败的那个响应。

Certbot 续期错误,第 2 步:对照错误

错误信息包含可能原因解决办法
Connection refused / Timeout during connect80 端口被防火墙拦截,或 Web 服务器已停止开放 80 端口并启动服务器
Invalid response / 404 for .well-knownwebroot 路径不对,或重写规则拦截了验证请求修正 webroot_path,或排除 /.well-known/acme-challenge/
DNS problem: NXDOMAIN 或 SERVFAILDNS 记录缺失或损坏修正 DNS,用DNS 查询检查
Could not bind to port 80Nginx 或 Apache 正在运行时用了 standalone 模式改用 nginx 或 apache 插件,或 webroot
too many certificates / rate limit每个已注册域名 7 天内 50 张证书,或每个标识符每小时 5 次验证失败(速率限制)等待,并用测试环境验证
CAA record forbids issuanceCAA 记录不允许 Let's Encrypt更新记录,用CAA 检查器核实
Unauthorized / 403安全规则或 CDN 拦截了请求放行验证路径,或改用 DNS 验证

常见修正

更换验证方式。如果原先用的是 standalone 模式,改成能与运行中的服务器共存的方式,编辑 /etc/letsencrypt/renewal/ 里的文件:

authenticator = webroot
webroot_path = /var/www/html

跳转。全局的 HTTP 到 HTTPS 跳转没问题,CA 会跟随跳转。但跳转到另一台宕机的主机,或对隐藏路径返回 403 的规则,会破坏验证。

通配符。这类证书需要 DNS 验证。用 DNS 插件让 TXT 记录在每次续期时自动创建。参见如何获取免费通配符证书。

Certbot 续期错误,第 3 步:确认计时器在运行

systemctl list-timers | grep certbot
sudo systemctl status certbot.timer

如果没有计时器,检查 /etc/cron.d/certbot。容器和 snap 安装方式不同,请查阅你所装方式的文档。

第 4 步:续期后重载服务器

续期替换了磁盘上的文件,但 Web 服务器必须重新读取。添加部署钩子:

sudo certbot renew --deploy-hook "systemctl reload nginx"

第 5 步:验证

用SSL 检查器查看线上证书的到期日。如果日期没变,服务器还在提供旧文件。长期防护可按监控 SSL 证书到期中所示设置提醒。

预防下一次失败

保持 Certbot 更新,改动 Web 服务器结构时同步更新续期配置,并且在改动防火墙、DNS、跳转或主机之后跑一次试运行。不要依赖到期邮件:Let's Encrypt 已于 2025 年 6 月 4 日停止发送(Let's Encrypt 公告),所以要另外设置到期提醒。

相关阅读:用 Certbot 获取免费 SSL 证书、自动续期免费 SSL 证书,以及在 Docker 上安装免费 SSL。

常见问题

试运行会计入速率限制吗?

它使用测试环境,那套环境有自己的、更宽松的限制。

我的证书过期了,还能续期吗?

能。先解决根本问题,然后运行 sudo certbot renew。过期证书是可以续期的。

我的证书存放在哪里?

在 /etc/letsencrypt/live/yourdomain/,作为指向当前文件的符号链接。

为什么 Certbot 只续期部分证书?

因为它只续期到期的证书。从 Certbot 4.0.0 起,这意味着剩余有效期不足三分之一,即 90 天证书的第 30 天、64 天证书的第 21 天左右、45 天证书的第 15 天(Certbot 文档)。4.0.0 之前这个窗口固定为 30 天。

为什么 Certbot 说我的证书还没到续期时间?

Certbot 会跳过剩余有效期超过三分之一的证书(Certbot 文档)。用 --dry-run 测试续期。强制续期会签发新证书,并计入每个已注册域名 7 天 50 张的限制(速率限制)。

🔒 Test Your Website SSL Certificate Now
Run Free SSL Check →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

免费 SSL 证书签发、在线 SSL 检测与 CSR 生成器

无需复杂服务器配置,60 秒快速获取 Let's Encrypt 与 Buypass 信任的 HTTPS 证书。

Related Articles

🤖 TryFreeSSL AI Assistant