certbot 自动申请与续期 Let’s Encrypt 证书
导出 PDF
浅色排版、带版权水印,可在打印窗口另存为 PDF

1. 安装
apt install certbot python3-certbot-nginx
2. 签发
certbot --nginx -d example.com -d www.example.com
3. 自动续期
certbot 会自动安装 systemd timer,手动验证:
certbot renew --dry-run
常见问题
- 80 端口被占用 → 先停占用进程或用 DNS 验证;
- 国内解析商 DNS 验证 → 改用 acme.sh + DNS API 更稳;
- 验证失败看
/var/log/letsencrypt/letsencrypt.log。