ssl-guides 2026-12-02 ⏱ 2 min read

Automate SSL Renewal with Certbot and Hooks

Automate SSL Renewal with Certbot and Hooks
Quick Answer: Certbot checks for renewals on a schedule and renews certificates that are close to expiry. Confirm that the timer or cron job exists, run sudo certbot renew --dry-run to test, and add a deploy hook so your web server reloads the new certificate.

How Certbot renewal works

Let's Encrypt certificates last 90 days today, and the default drops to 64 days from 10 February 2027 and 45 days from 16 February 2028 (Let's Encrypt announcement). Certbot's renew command looks at every certificate it manages and renews the ones that are due. As of Certbot 4.0.0 a certificate is due when less than a third of its lifetime remains, and before 4.0.0 the threshold was a fixed 30 days (Certbot docs). Check yours with certbot --version. Running it daily or twice a day is safe, because it does nothing when no certificate is due.

Check that renewal is scheduled

Packages from most distributions and snap installs create a systemd timer. Check it:

systemctl list-timers | grep certbot
cat /etc/cron.d/certbot 2>/dev/null

If you see neither, add a cron entry:

0 3,15 * * * root certbot renew --quiet --deploy-hook "systemctl reload nginx"

Test with a dry run

sudo certbot renew --dry-run

The dry run uses the staging server and does not change your live certificate. A pass means the challenge method, ports and permissions all work. Run it after any server change.

Reload the server after renewal

A renewed file on disk does nothing until the service reloads it. Use a deploy hook, which runs only after a successful renewal:

sudo mkdir -p /etc/letsencrypt/renewal-hooks/deploy
sudo tee /etc/letsencrypt/renewal-hooks/deploy/reload-web.sh > /dev/null <<'EOF'
#!/bin/sh
systemctl reload nginx
EOF
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/reload-web.sh

Replace nginx with apache2 or httpd as needed.

Why renewal fails

SymptomCauseFix
Timeout or connection refusedPort 80 blockedOpen port 80 in the firewall
404 on the challenge fileRedirect or location rule intercepts /.well-known/acme-challenge/Allow that path over HTTP
Domain no longer points to the serverDNS changedFix DNS or remove the certificate
Rate limitToo many attemptsWait and use dry runs while testing
DNS challenge failsAPI token expiredRenew the token in the plugin config

More detail in how to fix Let's Encrypt renewal failures.

Watch the expiry anyway

Automation can fail silently. Check the live certificate regularly with the SSL Checker or the Bulk SSL Checker. The wider industry schedule is in the 47-day roadmap. If you only need a one-off certificate, you can issue one on TryFreeSSL.com.

FAQ

How often should the timer run?

Twice a day is the usual recommendation. The extra runs are harmless.

Do I need to restart Nginx?

A reload is enough and does not drop connections.

Can I renew a single certificate?

Yes: sudo certbot renew --cert-name example.com.

What if I use wildcard certificates?

They need a DNS challenge, so make sure the DNS plugin and its credentials stay valid.

🔒 Test Your Website SSL Certificate Now
Run Free SSL Check →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

Free SSL Certificates, Live SSL Checker & CSR Generator

Issue trusted Let's Encrypt SSL certificates in 60 seconds with zero server setup.

Related Articles

🤖 TryFreeSSL AI Assistant