How to Renew SSL Certificates Automatically with Certbot (2026 Guide)

  • Web Hosting
  • Published
  • Updated:
  • 11 min read
  • By PickMyApp Research Team
Quick answer

Install Certbot on your server, get a free Let's Encrypt certificate with certbot --nginx (or --apache, or --standalone), then confirm automation: most Certbot installs ship with a systemd timer or cron job that runs certbot renew twice a day, renewing any certificate due to expire within 30 days. Test it once with sudo certbot renew --dry-run, verify the timer with systemctl list-timers, and add a deploy hook so your web server reloads after each renewal. That's the whole job — and with Let's Encrypt switching to 64-day certificates on February 10, 2027, setting this up now is no longer optional.

Illustration of a padlock surrounded by circular renewal arrows next to a server rack, representing automatic SSL certificate renewal

Every Let's Encrypt SSL certificate expires, by design. That is the whole point of free short-lived certificates: if one is compromised or misissued, it stops working soon. The trade-off is that you cannot install one and forget it. Certbot, the official client from the Electronic Frontier Foundation, handles the forgetting for you — it obtains the certificate, installs it, and renews it on a schedule without you touching the terminal again.

This guide walks through the complete setup: installing Certbot, getting your first certificate for nginx, Apache, or a standalone server, proving that renewal works with a dry run, verifying the automatic timer, and adding hooks so your web server picks up the new certificate. It is written for owners of a small virtual server — a $5 to $10 VPS from a provider like the ones in our cheap WordPress hosting guide works fine. Every command below follows the official Certbot documentation.

Why automatic renewal is now mandatory, not optional

On February 10, 2027, Let's Encrypt starts issuing certificates valid for 64 days instead of 90, and 45-day certificates follow in 2028. We covered the full timeline in our guide to Let's Encrypt's 64-day certificate change, including a five-step checklist for website owners.

The security logic is simple: shorter lifetimes shrink the window in which a stolen or misissued certificate can be abused. Let's Encrypt's own recommendation makes the operational consequence plain — renewals hardcoded to a fixed number of days from expiration should be switched to renewing at about two-thirds of the certificate lifetime. A cron job that renews 60 days after issuance works at 90 days but silently fails at 64.

Certbot's built-in behavior survives this change gracefully: certbot renew renews any certificate due to expire within 30 days, which is correct for both 90-day and 64-day lifetimes. That is exactly why the one-time setup below is worth doing before February 2027. Every publicly trusted certificate authority is moving the same direction — the CA/Browser Forum is capping lifetimes at 200 days from March 2026, 100 days from March 2027, and 47 days from March 2029 — so manual renewal is a dead end for every kind of certificate.

Quick fact: Let's Encrypt began issuing 64-day certificates in staging on October 14, 2026, so test your renewal setup there before the February 2027 production switch.

How Certbot renewal actually works

Certbot remembers everything you tell it. When you obtain a certificate, it saves your authenticator, installer, domains, and options in a renewal configuration file at /etc/letsencrypt/renewal/yourdomain.com.conf, and points your web server at symlinks under /etc/letsencrypt/live/yourdomain.com/ (fullchain.pem and privkey.pem). When renewal time comes, Certbot replays those same options — you never re-enter them.

The automation itself is a scheduled task: a systemd timer or cron job runs certbot renew twice a day, and each run renews only certificates expiring in less than 30 days; everything else is skipped untouched. Most runs change nothing, and the official docs note that adding your own scheduled task alongside a pre-installed one causes no harm.

One caveat to know up front: certificates created with the --manual plugin do not support automatic renewal unless you provide authentication hook scripts to automate the domain validation steps. If you used --manual, re-obtain the certificate with one of the automated plugins in Step 2 instead.

Step 1: Install Certbot

Install Certbot plus your web server's plugin. On Ubuntu or Debian:

sudo apt update

sudo apt install certbot python3-certbot-nginx

Replace python3-certbot-nginx with python3-certbot-apache if you run Apache. The EFF also publishes Certbot as a snap, which works on most distributions; follow the system-specific instructions at certbot.eff.org if your setup differs.

If your host manages SSL for you — many of the managed plans in our Cloudways vs SiteGround comparison install and renew certificates automatically — check your panel first. You only need this guide if you control the server yourself, typically a VPS or dedicated box.

Step 2: Get your first certificate

Pick the command that matches your server. In each case, replace example.com with your domain, and add -d www.example.com if you serve the www variant. Every command below authenticates you by proving control of the domain, then obtains the certificate.

If you run nginx

sudo certbot --nginx -d example.com -d www.example.com

The nginx plugin acts as both authenticator and installer: it proves control of your domains over HTTP (port 80) and edits your nginx configuration to use the new certificate and redirect HTTP to HTTPS. The official docs recommend backing up your nginx configuration first, and you can roll back with certbot --nginx rollback if something looks wrong.

If you run Apache

sudo certbot --apache -d example.com -d www.example.com

The apache plugin works the same way: it obtains the certificate and writes the HTTPS virtual host for you, including the SSLCertificateFile and SSLCertificateKeyFile directives that point at /etc/letsencrypt/live/. It can also set up the 301 redirect from HTTP to HTTPS.

If you run a different web server, or none at all

When Certbot cannot edit your server's configuration — HAProxy, OpenLiteSpeed, a Node app behind a reverse proxy — obtain the certificate only and install it yourself:

sudo certbot certonly --webroot -w /var/www/html -d example.com -d www.example.com

The webroot plugin writes a challenge file to /var/www/html/.well-known/acme-challenge/, which your running server must serve publicly on port 80. If nothing is listening on port 80 at all, use the standalone plugin instead — it starts its own temporary web server, but it needs port 80 free, so stop your existing server first:

sudo certbot certonly --standalone -d example.com -d www.example.com

For wildcard certificates (one certificate covering *.example.com and example.com), the official docs require a DNS plugin — DNS-01 is the only challenge type that issues wildcards. These plugins are not bundled with Certbot; install them separately for your DNS provider, for example:

sudo apt install python3-certbot-dns-cloudflare

then run with the plugin's flag. Check the plugin's own documentation for its credentials file.

Step 3: Test renewal safely with --dry-run

Do not wait 60 days to discover that renewal is broken. Certbot ships with a dry-run mode that simulates the full renewal against Let's Encrypt's staging server:

sudo certbot renew --dry-run

A dry run does not touch your real certificates and does not count against Let's Encrypt's rate limits, so you can run it as often as you like. What it does: it loads each renewal configuration, replays the original authentication, and reports success or failure. If this fails, your automatic renewals will fail the same way — read the error, fix the underlying cause (usually port 80 blocked or a moved webroot), and run the dry run again. Only proceed to Step 4 when the dry run passes for every certificate.

Two supporting commands worth knowing: sudo certbot certificates lists every certificate, its domains, and its expiry date; sudo certbot renew --cert-name example.com --dry-run tests one certificate in isolation.

Step 4: Confirm the automatic timer exists

Here is the part most tutorials skip. Obtaining a certificate does not guarantee renewal runs on schedule — verify that the scheduled task actually exists on your machine. The official docs say most installs come with automatic renewal preconfigured, via a systemd timer or cron job. Check both:

systemctl list-timers | grep certbot

On apt-based installs this usually shows certbot.timer; on snap installs it appears as snap.certbot.renew.timer. Check its status with systemctl status certbot.timer. If your system uses cron instead, look for the renew command in the system crontabs:

cat /etc/cron.d/certbot

If no timer and no cron entry exist — or you just want your own — add the cron job exactly as the official documentation prescribes. This appends a twice-daily renew to /etc/crontab with a random delay so millions of servers do not all hit Let's Encrypt at once:

SLEEPTIME=$(awk 'BEGIN{srand(); print int(rand()*(3600+1))}'); echo "0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null

Two runs a day looks like overkill, but remember: certbot renew only acts on certificates expiring within 30 days, so the extra runs cost almost nothing. The official docs explicitly say it is safe to add this even if a pre-installed timer already exists.

Step 5: Add a reload hook so servers use the new certificate

There is one more trap. Renewal replaces the files on disk, but nginx and Apache read their certificates at startup and keep the old ones in memory. Without a reload, visitors keep getting the expired certificate even though the new one is already on the server.

If you used --nginx or --apache in Step 2, the installer plugin handles the reload itself during renewal — nothing to do. Everyone else needs a hook. Certbot automatically runs every executable script placed in /etc/letsencrypt/renewal-hooks/deploy/ after a successful renewal. Create one:

sudo sh -c 'printf "#!/bin/sh\nsystemctl reload nginx\n" > /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh'

sudo chmod 755 /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh

Swap in systemctl reload apache2 for Apache, or a restart command for your application. A reload is graceful — it does not drop connections — which is why it is preferable to restart. Note the directory names: scripts in pre/ and post/ run around every attempt, while deploy/ scripts run only when a certificate was actually renewed.

Illustration of calendar pages looping around a glowing shield with renewal checkmarks, representing repeated automatic certificate renewals

Quick command reference

Every command in this guide, verified against the official Certbot documentation. Replace example.com with your domain.
TaskCommand
Install (Ubuntu/Debian, nginx)sudo apt update
sudo apt install certbot python3-certbot-nginx
Get certificate (nginx)sudo certbot --nginx -d example.com -d www.example.com
Get certificate (Apache)sudo certbot --apache -d example.com -d www.example.com
Get certificate only (webroot)sudo certbot certonly --webroot -w /var/www/html -d example.com
Get certificate only (standalone)sudo certbot certonly --standalone -d example.com
Test renewal (staging)sudo certbot renew --dry-run
Renew one certificate (test)sudo certbot renew --cert-name example.com --dry-run
List certificates and expiry datessudo certbot certificates
Check renewal timersystemctl list-timers | grep certbot
Add cron renewal (if missing)SLEEPTIME=$(awk 'BEGIN{srand(); print int(rand()*(3600+1))}'); echo "0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null

Troubleshooting automatic renewal

The dry run fails with a connection error

HTTP-01 challenges need the public internet to reach your server on port 80. Check the firewall (sudo ufw allow 80 on Ubuntu if UFW is running), confirm your DNS A record points at the server, and make sure time sync is enabled, since clock drift also breaks validation — make sure time sync is enabled.

Renewal succeeds but visitors still see the old certificate

The server did not reload after renewal. This is the missing-hook problem from Step 5. Confirm your deploy hook exists in /etc/letsencrypt/renewal-hooks/deploy/, that it is executable, and that it reloads the right service. Then manually reload once to fix the current state.

certbot renew says "not due for renewal yet" and exits

That is not an error — it is the correct behavior. The command only renews certificates expiring in less than 30 days. Do not use --force-renewal to work around it; the official docs warn that repeated forced renewals can run into Let's Encrypt's rate limits.

The certificate was obtained with --manual

Manual certificates do not auto-renew unless you supplied --manual-auth-hook and --manual-cleanup-hook scripts. The official recommendation is to re-obtain the certificate with one of the automated plugins instead, then let the normal timer handle it.

Summary

  • Install Certbot with your web server's plugin — python3-certbot-nginx or python3-certbot-apache on Debian/Ubuntu.
  • Obtain certificates with an automated plugin (--nginx, --apache, --webroot, --standalone, or a DNS plugin for wildcards); avoid --manual if you want auto-renewal.
  • Test with sudo certbot renew --dry-run — safe, free, and hits the staging server, not your rate limits.
  • Verify the timer — systemctl list-timers or /etc/cron.d/certbot; add the official cron line if nothing is there.
  • Add a deploy hook so nginx/Apache reloads after each renewal; the plugin installers already do this for you.
  • Act before February 2027: certbot renew's 30-day window works with 64-day certificates, but hardcoded custom renewal timers must move to about two-thirds of the certificate lifetime.

Frequently asked questions

Does Certbot renew SSL certificates automatically?

Yes. Most Certbot installs ship with a systemd timer or cron job that runs certbot renew twice a day. The command checks every certificate and renews any that expire within 30 days. You usually only need to confirm the timer exists and test renewal once with certbot renew --dry-run.

How do I test Certbot renewal without hitting rate limits?

Run sudo certbot renew --dry-run. The dry run simulates renewal against Let's Encrypt's staging server, so it does not count against production rate limits and does not replace your real certificates. Run it any time after changing renewal settings.

How often should certbot renew run?

Twice a day. Running certbot renew frequently is safe because the command renews only certificates due within 30 days of expiry, so most runs change nothing. The official documentation's example cron entry schedules it at 0:00 and 12:00 with a randomized sleep offset.

Why didn't my certificate renew automatically?

The most common causes are a renewal test nobody ran (port 80 blocked or a changed webroot), a missing reload hook, a certificate obtained with the manual plugin (which cannot auto-renew without hooks), or a timer that was never enabled. Check the timer and run certbot renew --dry-run.

Do I need to do anything for the Let's Encrypt 64-day certificate change?

If Certbot's automatic renewal is working, almost nothing. certbot renew triggers on certificates expiring within 30 days, which covers 64-day certificates too. Let's Encrypt suggests that renewals hardcoded to a date from expiration should instead renew at about two-thirds of the certificate lifetime.

Conclusion

Automatic SSL renewal with Certbot is a one-time, five-step job: install, obtain with an automated plugin, dry-run, verify the timer, and hook the reload. Once those are in place, your certificates renew themselves for years — the industry's shift to 64-day certificates in February 2027 and 45-day certificates in 2028 demands. If your host manages SSL for you, confirm in your panel that renewal is active. Either way, keep expiry dates monitored — automation plus verification is what keeps the padlock green.