What NGINX does on its own
NGINX does not renew certificates. It reads the files named by ssl_certificate and ssl_certificate_key when it starts or reloads, and keeps serving that certificate until the next reload, even if the files on disk have changed.
So automatic renewal on NGINX always has two parts: an ACME client that replaces the files, and a reload so NGINX reads them.
Renewing with Certbot
Certbot is the most common ACME client on Linux. Installed from a distribution package or snap, it adds a timer or cron job that runs certbot renew twice a day, and renews any certificate that is close to expiry, by default within 30 days.
Whether NGINX is reloaded depends on how the certificate was obtained:
- With the NGINX plugin (
certbot --nginx), Certbot reloads NGINX after renewal. - With
certonlyand the webroot or a DNS plugin, add a deploy hook, for example--deploy-hook "systemctl reload nginx"or a script in/etc/letsencrypt/renewal-hooks/deploy/. Deploy hooks run only after a successful renewal.
Test the whole path with certbot renew --dry-run, which uses the staging environment and does not replace your certificates.
Checking that it worked
A renewal that succeeds on disk but is never loaded looks fine until the old certificate expires. After each renewal, check:
nginx -tpasses before the reload, so a configuration error does not stop the reload.- The certificate NGINX serves for each server name is the new one, with the full chain from
fullchain.pem. - Every server that shares the certificate was reloaded, not only the one where the client runs.
Our guide to how to stop certificate expiry outages covers checking the served certificate in more detail.
Where it gets hard
- Many servers. Each one renews alone, so a failed timer on one host goes unnoticed.
- Load-balanced pools. The same name served by several NGINX hosts needs the same certificate on all of them, or one ACME client with a way to copy it.
- DNS credentials. DNS-01 for wildcards puts DNS API credentials on the web server, which Let’s Encrypt calls risky.
- Lifetimes. Certificates are moving toward 47 days, as covered in certificate lifetimes are falling to 200, 100 and 47 days, so renewals happen twice as often.
How clm.mt handles NGINX
A clm.mt agent on the server, or a runner with SSH access, renews the certificate with DNS-01 without keeping DNS credentials on the web server, writes the files, tests the configuration, reloads NGINX and checks the served certificate. The same applies to Apache, HAProxy and the other servers on the integrations board.
clm.mt status
Supported for NGINX. Real software lab. Reload and configuration requirements vary by service. See the integrations board for every tested scope, and the documentation to plan a pilot.
Other platform guides
- AD CS certificate autoenrollment and auto renewal
- AWS load balancer certificate renewal with ACM
- Azure Key Vault certificate auto renewal, and when it does not happen
- F5 BIG-IP SSL certificate renewal automation
- FortiGate ACME certificates and automatic renewal
- IIS SSL certificate auto renewal on Windows Server
- Kubernetes certificate management and TLS Secret renewal
- NetScaler ADC SSL certificate renewal and update
- Palo Alto firewall certificate renewal automation