certbot 配了 cron,看着一直在跑。直到客户说网站打不开,才发现证书过期两个月。
日志:
Certbot failed to authenticate some domains (authenticator: nginx).
Detail: Invalid response from http://example.com/.well-known/acme-challenge/xxx: 404
半年前加了条 Nginx 规则,把 .well-known 也拦了(当时为了防扫描)。续期验证走 80 端口,直接 404。
处理:加 location 放行,立刻成功。
现在的做法:
- 续期失败必须告警,deploy-hook 里推 webhook
- 单独监控证书剩余天数,低于 15 天报警
- 不用 nginx 插件,改
--webroot,路径固定不被别的规则影响