A Let’s EncryptLet’s Encrypt A free, non-profit service that gives websites the certificate they need for the padlock, and renews it automatically. More about Let’s Encrypt → certificate lasts 90 days, and Certbot is the tool that renews it. Normally this happens on its own, with nothing for you to do. This guide shows how to confirm that it will, how to renew by hand, and what to check when a renewal fails, before your visitors see a browser warning.
Run sudo certbot renew --dry-run to test renewal without changing anything. If it succeeds, automatic renewal is working. To renew immediately, run sudo certbot renew. Certbot only renews certificates with 30 days or less left, and it needs portPort A numbered door on a server. Each service listens behind its own door: web pages on 443, email on others, remote login on 22. More about Port → 80 reachable and your domain still pointing at the server.
Check what you have
List every certificate Certbot manages, with its expiry date:
sudo certbot certificates
Each entry shows the domain names covered, the expiry date and the VALID number of days remaining. If the list is empty, the certificate was probably not issued with Certbot; the guide to getting a free certificate with Let’s Encrypt starts from the beginning.
Check that automatic renewal is scheduled
Certbot installs a timer that runs twice a day. On Ubuntu, Debian and AlmaLinux with the packaged version, confirm it is active:
systemctl list-timers | grep certbot
You should see a certbot.timer entry with a next run time. If you installed Certbot with snap, the timer is snap.certbot.renew.timer. Older setups use a cronCron job A task the server runs by itself on a timetable, like an alarm clock for jobs. For example, making a backup every night at 3 a.m. More about Cron job → entry in /etc/cron.d/certbot instead. Any one of these is fine; having none is the problem.
Test renewal safely
A dry run goes through the whole process against Let’s Encrypt’s test servers, without replacing your real certificate and without counting against rate limits:
sudo certbot renew --dry-run
At the end you want to see Congratulations, all simulated renewals succeeded. Run this after changing anything about your web serverWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server →, firewall or DNS, because those are the usual things that break renewal months later.
Renew now
To renew everything that is due:
sudo certbot renew
To renew one certificate regardless of how many days are left, name it and force it:
sudo certbot renew --cert-name example.com --force-renewal
Use --force-renewal sparingly. Let’s Encrypt limits how many certificates you can issue for the same names each week, and repeated forced renewals can lock you out for days. The limits are listed in their rate limit documentation.
Make your web server pick up the new certificate
Renewing writes a new certificate file, but your web server keeps serving the old one until it reloads. Certbot’s own plugins usually handle this, but you can make it explicit with a deploy hook, which runs only after a successful renewal.
For NginxNginx A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it. More about Nginx →:
sudo certbot renew --deploy-hook "systemctl reload nginx" --dry-run
To make it permanent, add the same hook to the certificate’s configuration file in /etc/letsencrypt/renewal/example.com.conf under [renewalparams]:
renew_hook = systemctl reload nginx
For ApacheApache One of the most common programs that sends web pages to visitors. It is the waiter between your website’s files and the people asking for them. More about Apache →, use systemctl reload apache2 on Ubuntu or systemctl reload httpd on AlmaLinux.
When renewal fails
Read the log first. It names the exact reason:
sudo tail -n 60 /var/log/letsencrypt/letsencrypt.log
| Symptom or message | Cause | Fix |
|---|---|---|
| Timeout during connect, or connection refused on port 80 | Firewall or host blocks port 80 | Open port 80 in the firewall; see ports |
| Invalid response, 404 on the challenge file | Wrong site answers on port 80, or a redirect rule intercepts /.well-known/ | Let the challenge path through before any redirect |
| DNS problem: NXDOMAIN or no valid A record | Domain no longer points at this server | Fix the A record; see DNS propagation |
| Too many failed authorisations | Repeated failures hit a limit | Fix the cause, wait an hour, then retry with --dry-run |
| Too many certificates already issued | Weekly rate limit reached | Wait for the window to pass; do not force renew |
| Could not bind to port 80 | standalone mode while a web server is running | Use the nginx or webroot method instead |
If your site sits behind a CDN or proxy, the challenge request may never reach your server. Either pause the proxy for renewal, or switch to the DNSDNS The internet’s phone book. It turns a name people can remember, like example.com, into the number address computers use to find the server. More about DNS → challenge, which does not need port 80.
Switching to a more reliable method
If you originally used --standalone, which briefly stops your web server, change to the plugin that matches it so renewals never cause downtime:
sudo certbot renew --cert-name example.com --nginx --dry-run
The --webroot method is another choice. It writes the challenge file into your site folder, so the web server keeps running throughout.
Monitoring so you are never surprised
- Check expiry from outside with
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates. - Let’s Encrypt no longer sends expiry emails, so use an uptimeUptime How much of the time a website or server is working and reachable, usually shown as a percentage like 99.9%. More about Uptime → monitor that also watches certificate expiry. See what uptime means.
- Put a calendar reminder two months after each new issue, just for the first few cycles, until you trust the timer.
Official documentation
- Certbot user guide, Electronic Frontier Foundation.
- Rate limits, Let’s Encrypt.
Related
- How to get a free SSL certificate with Let’s Encrypt, for the first issue.
- How HTTPS works, why certificates expire at all.
- How to fix “Your connection is not private”, for what visitors see when one lapses.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.

