How to Force Renewal of an Expired Let's Encrypt SSL Certificate with Certbot
The expired SSL certificate error when accessing your website, despite using Let's Encrypt's Certbot, typically occurs because the automatic renewal service failed silently due to port 80 being blocked by your conflicting web server, or due to changes in your DNS records.
QUICK DIAGNOSTICS // RESOLUTION MATRIX
CAUSA
Expired Let's Encrypt SSL/TLS certificate due to failed renewal
SOLUTION
Force certificate renewal:
sudo certbot renew --force-renewal
CAUSA
Failed HTTP-01 challenge because port 80 is closed
SOLUTION
Ensure web server listens on port 80 and restart Nginx/Apache
Step-by-Step Solution
-
1
Step 1: Identificar y liberar puertos bloqueados
Let's Encrypt uses the HTTP-01 challenge to verify that you own the domain, which requires free access on port
80. Temporarily stop the conflicting web server:BASH# Si utilizas Nginx sudo systemctl stop nginx # Si utilizas Apache sudo systemctl stop apache2 -
2
Step 2: Ejecutar la renovación forzada de Certbot
Start the forced manual renewal to ignore previous expiration cache policies:
BASH# Forzar la renovación en consola sudo certbot renew --force-renewal(Verify that the console returns a success message:
Congratulations, all renewals succeeded). -
3
Step 3: Volver a iniciar los servidores web y verificar
Restart your production services to apply the new cryptographic keys:
BASHsudo systemctl start nginx sudo systemctl start apache2
Prevention Advice
Recommended security practices:
- Do not rely solely on periodic manual renewals for the security of your sites. Make sure to verify that Certbot's internal automatic renewal timer is active in the system, which will validate the certificate status twice a day:
If HTTP challenges on port 80 regularly fail due to corporate security firewalls, migrate your validation process to the DNS-01 challenge using the corresponding APIs of your DNS provider (Cloudflare, Route53, etc.).BASH
# Verificar el estado del temporizador systemd systemctl list-timers | grep certbot