Let's Encrypt certificate not renewing? How to troubleshoot certbot on nginx and Apache
Let's Encrypt certificates last 90 days and renew automatically, until something changes: a firewall rule, a redirect, a moved site. The renewal fails quietly and the site shows a security warning weeks later.
See the expiry dates
Anything under 30 days should have renewed already.
sudo certbot certificatesCheck that renewal is scheduled
On Ubuntu and Debian a systemd timer runs twice a day.
systemctl list-timers | grep -i certbot systemctl status certbot.timer --no-pager | head -n 6Run a dry run
It tests renewal against the staging server and shows the exact error without using your rate limit.
sudo certbot renew --dry-runCheck the usual causes
Port 80 must be reachable from the internet, the challenge path must not be redirected or blocked, and the domain must still point to this server.
sudo ss -ltnp | grep ':80' sudo ufw status | grep -E '80|443' curl -I http://your-domain.com/.well-known/acme-challenge/testRead the log
The last lines name the failing domain and the reason.
sudo tail -n 40 /var/log/letsencrypt/letsencrypt.logRenew now and reload the web server
Then confirm the new dates.
sudo certbot renew sudo systemctl reload nginx sudo certbot certificates
Common mistakes
- A redirect to HTTPS that also catches the challenge path on a site with no valid certificate yet.
- Cloudflare in proxy mode with a mismatched SSL setting.
- Port 80 closed in the firewall after hardening.
How to undo it
Certbot keeps the previous certificate files until renewal succeeds; the old certificate remains valid until its expiry date.
Sources
Commands are for Debian and Ubuntu unless noted. Test on a copy first and keep a backup: you are responsible for changes on your own systems.