Automate SSL Certificate Deployment
Automate SSL certificate deployment: the parts
- An ACME client that talks to the CA.
- A validation method, HTTP-01 or DNS-01.
- A scheduler, usually a systemd timer or cron.
- A deploy hook that reloads the service after renewal.
- Monitoring that tells you if any of it stops.
Certbot with Nginx
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-runMost packages install a timer that runs renewal twice a day and renews only certificates close to expiry. List timers with systemctl list-timers to confirm it exists.
For a custom reload step, add a hook:
# /etc/letsencrypt/renewal-hooks/deploy/reload.sh
#!/bin/sh
systemctl reload nginxMake it executable with chmod +x.
acme.sh alternative
curl https://get.acme.sh | sh
acme.sh --issue -d example.com -w /var/www/html
acme.sh --install-cert -d example.com \
--key-file /etc/ssl/example/private.key \
--fullchain-file /etc/ssl/example/fullchain.pem \
--reloadcmd "systemctl reload nginx"Review any script before piping it to a shell, and use your package manager when available.
Choosing the setup
| Setup | Best for | Note |
|---|---|---|
| Certbot plugin | Single server with Nginx or Apache | Simplest, edits config for you |
| acme.sh or lego | Many DNS providers, minimal servers | Lightweight |
| Reverse proxy with built-in ACME | Containers | Certificates managed by the proxy |
| Host or CDN managed | Shared hosting, SaaS | Nothing to run |
Multiple servers
When several servers share a certificate, issue it in one place and copy it with a deploy hook, using SSH keys with limited rights or a secrets store. Reload each service afterward. Avoid every node requesting its own certificate for the same names, since CA rate limits can stop you.
Automate SSL certificate deployment: test and watch
- Run the dry run after any change to DNS, firewall or web server config.
- Check the live certificate with the Live SSL Checker after the first real renewal.
- Set an alert that fires while at least a third of the certificate lifetime is left, so a silent failure becomes visible.
- Keep an eye on the headers too, since reloads can reset custom config.
Related reading: automatic renewal, expiry alerts as the safety net, Enable HTTPS for Next.js on Vercel or Nginx and when automatic renewal fails.
Frequently Asked Questions
How often should renewal run?
Twice a day is normal. The client renews only when the certificate is near expiry.
Why did automatic renewal fail?
Common causes are changed DNS, a blocked port 80, a stopped timer or an expired DNS API token.
Do I need to restart the server?
A reload is enough in most cases. A deploy hook makes it automatic.
Can I automate without root access?
Often yes with acme.sh in a user account, if you can place files and trigger a reload.
Do I need a deploy hook if the certificate is on the same server?
Yes, unless your web server reloads on its own. The client writes the new files and the server keeps serving the old certificate from memory until it reloads. A hook that tests the config and reloads closes that gap.
How do I test automation without risking an outage?
Run the renewal in dry-run mode first, then force one real renewal on a staging host and watch the reload. A dry run proves the challenge works; only a real renewal proves the reload and the file permissions.
What happens if the renewal fails silently?
Nothing renews, and the site keeps serving the old certificate until it expires. Add an expiry check that fires while a third of the lifetime is left, and alert on it, so a failed renewal is caught weeks before the certificate dies.
Can one client manage certificates on several servers?
It can, if each server can answer the challenge. HTTP-01 needs port 80 reachable on the hostname, so a DNS-01 challenge is simpler when certificates are issued centrally and copied out to the servers.
✅ 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
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.