在 Debian 中,Nginx 使用的 SSL 证书续期方式取决于你是怎么申请的证书。下面按常见情况说明。
which certbot
certbot certificates
如果能看到证书列表,说明是用 certbot 管理的。
sudo certbot renew --dry-run
sudo certbot renew
Debian 下 certbot 通常会创建:
/etc/cron.d/certbotcertbot.timer查看状态:
systemctl status certbot.timer
启用(如未启用):
sudo systemctl enable --now certbot.timer
certbot 一般会自动 reload nginx,如未生效:
sudo systemctl reload nginx
~/.acme.sh/acme.sh --list
~/.acme.sh/acme.sh --renew -d example.com
~/.acme.sh/acme.sh --renew -d example.com --force
acme.sh 默认会写 cron:
crontab -l
自签证书无法自动续期,只能重新生成:
openssl req -x509 -newkey rsa:2048 \
-keyout /etc/nginx/ssl/example.key \
-out /etc/nginx/ssl/example.crt \
-days 365 -nodes
然后:
sudo systemctl reload nginx
检查:
nginx -t
systemctl reload nginx
✅ 使用 Let’s Encrypt + certbot
✅ 不要手动复制证书文件
✅ 让 certbot 自动管理 nginx 配置
如果你愿意,可以贴一下:
nginx -V/etc/nginx/sites-enabled/ 配置我可以帮你精确判断该怎么续期。