Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Certbot renewed but the site still shows the old certificate: reload, deploy hooks and the right file

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When Certbot reports a successful renewal but browsers still show the old certificate and its old expiry date, the new files exist on disk and the running web server has not picked them up, or it is reading a different file. Compare the serial number of the certificate on disk with the one the server sends. If they differ, reload the web server, then add a deploy hook so the next renewal reloads it automatically.

What the symptom means

Certbot keeps each certificate under /etc/letsencrypt/live/$domain. Its guide says: "Rather than copying, please point your (web) server configuration directly to those files (or create symlinks). During the renewal, /etc/letsencrypt/live is updated with the latest necessary files."

That updates files. It does not by itself tell a running web server to read them. The nginx manual describes reload as "reload configuration, start the new worker process with a new configuration, gracefully shut down old worker processes", and Apache's apachectl graceful as a graceful restart that does not abort open connections. The Apache "Stopping and Restarting" page says a graceful restart is when "The parent re-reads its configuration files and re-opens its log files." So a server that has not been reloaded since the renewal is still running with what it loaded earlier.

Certbot's answer to this is the deploy hook. Its guide says: "If you want your hook to run only after a successful renewal, use --deploy-hook". Executable files found in /etc/letsencrypt/renewal-hooks/pre, /etc/letsencrypt/renewal-hooks/deploy and /etc/letsencrypt/renewal-hooks/post "will be run as pre, deploy, and post hooks respectively", in alphabetical order, so a file in the deploy directory runs as a deploy hook. A plain certbot renew exit status does not tell you a renewal happened: "certbot renew exit status will only be 1 if a renewal attempt failed. This means certbot renew exit status will be 0 if no certificate needs to be updated."

Likely causes

Cause What you see How to confirm
The web server was never reloaded after the renewal The files on disk are new, the served certificate is old The serial number on disk differs from the served one
No deploy hook, or the hook is not executable Every renewal needs a manual reload ls -l /etc/letsencrypt/renewal-hooks/deploy shows no executable file, and the renewal file has no hook
The hook ran and failed A reload command in the hook failed, such as a configuration error The Certbot log; the guide says a failing hook's "error will be printed to stderr but renewal will be attempted anyway"
The server reads a different file The configuration names a copy, an old path or another certificate name The path in the server configuration differs from Certificate Path in certbot certificates
A second certificate name was created Names such as example.com-001 exist certbot certificates lists two entries for the same domain
The renewal did not happen certbot certificates shows the old expiry The expiry date shown is the old one; check the timer and the log
TLS ends at another device The server itself serves the new file, the public address serves the old one A local test shows the new serial while the public test shows the old one

Prove the cause before changing anything

All of these are read-only.

1. Ask Certbot what it holds.

certbot certificates

For each certificate the guide's sample output shows the name, the domains, the expiry date and the path of fullchain.pem. Note the expiry date and the path.

2. Show the serial number of the file on disk. The guide says cert.pem "contains the server certificate by itself":

openssl x509 -noout -dates -serial -in /etc/letsencrypt/live/example.com/cert.pem

The OpenSSL manual defines -noout as preventing "output except for printing as requested", -dates as printing "the start and expiry dates", and -serial as printing the serial number.

3. Show what the server actually sends. Run this from the server itself, so a load balancer is not involved:

openssl s_client -connect 127.0.0.1:443 -servername app.example.com -showcerts -no-interactive

-servername sets the name sent for SNI, and -showcerts displays "the server certificate list as sent by the server". The first certificate block is the server's own certificate. Copy that block, from the line -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----, into a new file such as /root/served.pem, then run:

openssl x509 -noout -dates -serial -in /root/served.pem

If the serial is the old one, the server has not loaded the new file or reads another file. If it matches the file on disk but a public check shows the old one, something else is answering. Repeat step 3 from outside using the public name and address.

4. Find which file the server reads. For nginx, nginx -T prints the configuration; look for ssl_certificate and ssl_certificate_key. For Apache, read the virtual host for SSLCertificateFile and SSLCertificateKeyFile. Compare each path with the one certbot certificates printed.

5. Check the automation.

ls -l /etc/letsencrypt/renewal-hooks/deploy
systemctl list-timers

The guide suggests looking for the certbot renew command "in either your system's crontab (typically /etc/crontab or /etc/cron.*/*) or systemd timers (systemctl list-timers)". Also read /etc/letsencrypt/renewal/NAME.conf, one of the "renewal configuration files" the guide locates at /etc/letsencrypt/renewal/CERTNAME.conf (the guide says "Certbot will keep track of all of the relevant options chosen by the user"), and check the log in /var/log/letsencrypt.

Fix

Reload the web server

Disruptive step: a reload replaces the web server's worker processes. The nginx manual says old workers shut down gracefully, and Apache's graceful leaves open connections running, but a configuration that fails its test must be fixed first. The commands below check before they reload: nginx -t "checks the configuration for correct syntax, and then tries to open files referred in the configuration", and the apachectl page says graceful checks the configuration "as in configtest before initiating the restart". Reload in a quiet period. There is nothing to restore when the configuration is unchanged. If you edit the configuration, use the save-first and back-out steps in the next section.

For nginx, test the configuration, then reload:

nginx -t
nginx -s reload

For Apache:

apachectl configtest
apachectl graceful

Point the configuration at the live files

Certbot's guide says fullchain.pem is "what Nginx needs for ssl_certificate" and what Apache 2.4.8 or later needs for SSLCertificateFile, and that privkey.pem is for ssl_certificate_key and SSLCertificateKeyFile. If the configuration names a copy or an older path, change it to the live path. Save the file first, outside any directory your configuration includes by wildcard:

cp -p /etc/nginx/conf.d/app.example.com.conf /root/app.example.com.conf.2026-11-20

Disruptive step: the nginx reload that follows your edit applies the change to live traffic. Edit the paths, then run nginx -t and nginx -s reload. To back out, restore the saved copy under the name you saved it, test, and reload:

cp -p /root/app.example.com.conf.2026-11-20 /etc/nginx/conf.d/app.example.com.conf
nginx -t
nginx -s reload

For Apache, save the file that holds SSLCertificateFile and SSLCertificateKeyFile first (the path here is an example; use the one your virtual host is in):

cp -p /etc/apache2/sites-available/app.example.com.conf /root/app.example.com.apache.conf.2026-11-20

Disruptive step: the graceful restart that follows your edit applies the change to live traffic on every site Apache serves. Edit the two paths, then run apachectl configtest and apachectl graceful. To back out, restore the saved copy under the name you saved it, test, and apply:

cp -p /root/app.example.com.apache.conf.2026-11-20 /etc/apache2/sites-available/app.example.com.conf
apachectl configtest
apachectl graceful

Add a deploy hook

Disruptive step: a deploy hook like the one below reloads the live web server after every real renewal. Add it in a quiet period; to back out, remove only the hook file.

Create an executable file in /etc/letsencrypt/renewal-hooks/deploy, for example reload-nginx.sh, with these two lines:

#!/bin/sh
nginx -t && nginx -s reload

For Apache, use apachectl configtest && apachectl graceful. Check what is already in the directory, create the file with your editor, then make it executable, as the guide's own hook example does with chmod 755:

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

Disruptive step: the dry run below with --run-deploy-hooks runs your hook against the live web server, so it reloads it. A dry run also "may trigger webserver reloads to temporarily modify & roll back configuration files". Run it in a quiet period.

Certbot passes $RENEWED_LINEAGE and $RENEWED_DOMAINS to deploy hooks if you want a hook to act only for some certificates. To test, the guide says --dry-run runs --pre-hook and --post-hook by default but "--deploy-hook commands do not run, unless enabled by --run-deploy-hooks":

certbot renew --dry-run --run-deploy-hooks

To back out, remove only the hook file you created, after ls -l has shown it:

ls -l /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh
rm /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh

Other certificate names and other devices

If certbot certificates lists two entries for the same domain, the guide explains that a name collision makes Certbot build "the new certificate name ... using a numerical sequence as example.com-001". Point the configuration at the entry that is current. If the server serves the new certificate but the public address serves the old one, the certificate must be replaced on the device that ends TLS. For the case where the right file is served for the wrong name, see "Browser shows the wrong certificate for a site: SNI and the default virtual host".

Example (illustrative): On web01, the Certbot timer renews app.example.com, and certbot certificates shows the expiry moved forward. Browsers still show the old expiry. The serial number from cert.pem on disk is different from the one in /root/served.pem. /etc/letsencrypt/renewal-hooks/deploy is empty. The administrator runs nginx -t and nginx -s reload; the serial now matches. The administrator then adds reload-nginx.sh to the deploy directory, makes it executable and runs the dry run with --run-deploy-hooks.

Confirm the fix

  1. Repeat step 3 from the server and from outside. The served serial matches the serial of cert.pem on disk.
  2. certbot certificates and a browser show the same, new expiry date.
  3. certbot renew --dry-run --run-deploy-hooks completes without hook errors.
  4. After the next real renewal, the Certbot log in /var/log/letsencrypt shows the deploy hook ran, and the served serial changes without anyone reloading the server by hand.

What to watch afterwards

  • Check the expiry the world sees, not only the files. openssl x509 -checkend "exits nonzero if yes it will expire", so a monitor can run it on a certificate it has just fetched from the public address with the step 3 command (a file saved earlier does not follow later changes on the server). For 21 days, use 21 × 24 × 3,600 = 1,814,400 seconds: openssl x509 -checkend 1814400 -noout -in /root/served.pem.
  • Alert on renewal failures from the timer and on a hook that exits with an error.
  • Re-check the configured paths after any change of Certbot certificate names.
  • After a web server upgrade or migration, confirm the deploy hook file is still present and executable.

Risks and limits

  • These commands have not been run or lab-tested.
  • The nginx and Apache pages describe reading configuration at reload or graceful restart; they do not state in those words that a running server keeps an old certificate until then.
  • Hooks in renewal-hooks directories run for every certificate. Use the environment variables if one hook should not act on all of them.
  • openssl s_client options and output vary with the OpenSSL version. The options shown follow the OpenSSL 3.5 manual pages.
  • Containers, load balancers and CDNs that hold their own copy of the certificate are not covered in detail.

Sources

  • Certbot User Guide — Electronic Frontier Foundation, stable documentation, no date or version shown, accessed 20 November 2026
  • nginx: command-line parameters — nginx documentation, no date shown, accessed 20 November 2026
  • apachectl — Apache HTTP Server 2.4 documentation, no date shown, accessed 20 November 2026
  • Stopping and Restarting Apache HTTP Server — Apache HTTP Server 2.4 documentation, no date shown, accessed 20 November 2026
  • openssl-s_client — OpenSSL 3.5 documentation, no date shown, accessed 20 November 2026
  • openssl-x509 — OpenSSL 3.5 documentation, no date shown, accessed 20 November 2026
  • systemctl — systemd 262 documentation, no date shown, accessed 20 November 2026