首页/安全/加密与证书速查/certbot 实战:签发与续期

certbot 实战:签发与续期

certbot 是常用 ACME 客户端:支持 nginx/apache 插件自动配置,也支持 webroot 与手动模式;续期由定时任务或 systemd timer 触发。

加密与证书速查安全更新于 2026-10-12
webrootcertbot certonly --webroot -w /var/www/html -d example.com
nginx 插件certbot --nginx -d example.com(自动改配置并重载)
dry-runcertbot renew --dry-run 验证续期链路
钩子--deploy-hook 在续期成功后执行重载命令

签发与续期验证

签发与续期验证
certbot certonly --webroot -w /var/www/html -d example.com
certbot renew --dry-run
systemctl list-timers | grep certbot
certonly 只签发不安装:适合证书要分发到多台后端或负载均衡的场景,避免单机插件改动线上配置。

易错点

  • 只签发了证书但没配置重载,服务仍加载旧证书直到手动重启
  • webroot 路径与实际站点根不一致导致 http-01 校验返回 404

数据来源与参考

  • certbot 官方文档(eff.org)
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌