Automated TLS renewal removes a recurring operational risk, but only when the ACME client, DNS permissions, web server reload, and monitoring are tested together. This guide covers HTTP-01 and DNS-01 challenges, Nginx renewal hooks, wildcard certificates, provider API choices, preflight checks, and a review schedule you can use to keep HTTPS dependable.
Overview
ACME is the protocol used by certificate authorities to automate domain validation and certificate issuance. An ACME client, such as Certbot or another compatible tool, proves control of a domain, obtains a certificate, and stores the resulting files on the server. A renewal job then repeats that process before the certificate expires.
The certificate request and the validation method are separate decisions. The two common ACME challenges are:
- HTTP-01: The client places a temporary token under
/.well-known/acme-challenge/. The certificate authority retrieves that token over HTTP. This works well when the domain reaches the server directly and port 80 can serve the challenge. - DNS-01: The client creates a temporary TXT record under
_acme-challenge.example.com. The certificate authority checks DNS instead of connecting to the web server. This is useful for wildcard certificates, private services, and hosts that are not directly reachable from the public internet.
For a basic public Nginx site, HTTP-01 is often the simpler starting point. For a wildcard such as *.example.com, DNS-01 is required. Whichever method you choose, treat renewal as a production workflow: use narrowly scoped credentials, test the renewal path, reload Nginx only after validation succeeds, and alert before expiry.
If Nginx is also routing applications, first confirm the proxy and health-check behavior described in the Nginx reverse proxy setup guide. Certificate automation should complement that configuration rather than introduce an unrelated reload process.
What to track
1. Certificate inventory
Keep a small inventory for every certificate and record the exact names it covers, the ACME client responsible for it, the challenge type, the certificate and key paths, and the service that consumes it. Include certificates for staging, internal dashboards, APIs, and alternate hostnames; these are easy to overlook because they may not be part of the main website.
A useful inventory row includes:
- Common name and subject alternative names
- Production or non-production environment
- HTTP-01 or DNS-01 validation
- DNS provider and API credential identifier, if applicable
- Nginx configuration file and certificate paths
- Renewal job, last successful renewal, and next review date
2. Renewal health
Track more than the certificate's expiration date. Record whether the last simulated renewal completed successfully, whether the certificate files changed, whether Nginx accepted the new configuration, and whether the service remained reachable afterward. A successful ACME transaction does not guarantee that the application is serving the newly issued certificate.
3. DNS challenge behavior
For DNS-01, monitor the ability to create and remove TXT records, the authoritative nameservers for the zone, and the time required for the challenge record to become visible. The API account should normally be limited to the required zone and record operations. Avoid placing a broad account token in a shared repository or in an application container that does not need DNS access.
The following comparison is a decision aid rather than a ranking:
| Provider pattern | Useful for | Check before adoption |
|---|---|---|
| DNS provider with an ACME plugin | Single-server or small-team automation | Plugin maintenance, token scope, and record cleanup behavior |
| Cloud DNS service with an API or SDK | Infrastructure managed alongside cloud resources | Identity permissions, zone selection, audit logging, and propagation handling |
| DNS managed through Terraform | Teams that want reviewed, reproducible zone changes | Separation between planned infrastructure changes and short-lived ACME TXT records |
| Manual DNS workflow | Low-frequency certificates or restricted environments | Expiration ownership, documented approval, and a tested fallback procedure |
For broader DNS audits, use the DNS runbook for auditing and troubleshooting Cloudflare, Route 53, and DigitalOcean. It can help keep certificate validation records aligned with the rest of your DNS inventory.
Cadence and checkpoints
Initial setup
- Confirm that each hostname resolves to the intended service and that Nginx can answer for it.
- Choose HTTP-01 for a directly reachable web server or DNS-01 for wildcard and DNS-driven validation.
- Install an ACME client using the operating system's supported package method or the client's documented installation process.
- Run a staging or dry-run request first. This tests account access, challenge handling, and local permissions without treating the result as a production certificate.
- Store private keys with restrictive permissions and give the renewal process only the access it needs.
- After issuance, run
nginx -tbefore reloading Nginx.
Reusable renewal-hook pattern
The exact hook location varies by ACME client, but the operational sequence should remain consistent: renew, validate the Nginx configuration, reload gracefully, and verify the endpoint. A shell hook can follow this pattern:
#!/usr/bin/env sh
set -eu
nginx -t
systemctl reload nginx
# Replace this with an endpoint check appropriate to your service.
curl --fail --silent --show-error https://example.com/healthz >/dev/null
Do not reload Nginx unconditionally from an unrelated scheduled task. Attach the hook to the client's successful renewal event where possible. If the endpoint check fails, send an alert and investigate rather than repeatedly restarting the service.
Monthly or quarterly review
At a regular operations review, run a dry-run renewal, inspect the ACME client logs, confirm that the DNS token can be created with the current credential, and check that Nginx is serving the expected certificate. Review the certificate inventory for newly added hostnames and remove entries for retired services. A monthly check is appropriate for systems with frequent changes; a quarterly check may be sufficient for stable environments if expiry alerts are also active.
How to interpret changes
A dry run fails, but the live certificate is still valid: Treat this as an early warning. Check DNS credentials, zone identifiers, API endpoint configuration, and challenge visibility before the next renewal window. For HTTP-01, inspect redirects, firewall rules, load balancers, and any Nginx location block that could intercept the challenge path.
DNS-01 times out or cannot find the TXT record: Verify that the ACME client is updating the authoritative DNS provider, not merely a secondary dashboard. Query the authoritative nameservers directly when possible. Existing TXT records do not always indicate that the newly created token is visible; inspect the record value and name carefully, including the _acme-challenge label.
Renewal succeeds but browsers show the old certificate: The certificate may have been written to a different path than the one referenced by Nginx, or Nginx may not have reloaded. Compare the configured paths with the client output, run nginx -t, reload gracefully, and inspect the externally served certificate.
Nginx reload fails: Do not delete the existing certificate or force a restart as the first response. Check syntax, file ownership, key permissions, duplicate server blocks, and referenced include files. The previous worker processes may continue serving the existing valid configuration, but confirm service status and logs before declaring recovery.
Several certificates fail at once: Look for a shared dependency: an expired API token, changed nameserver delegation, a broken scheduled job, system time drift, outbound network restrictions, or a package update. If only one hostname fails, focus on its DNS, virtual host, and challenge path instead.
When to revisit
Revisit this workflow at least monthly or quarterly, and immediately after any change to DNS hosting, domain delegation, Nginx configuration, firewall rules, load balancing, operating-system packages, or ACME credentials. Also review it when adding a wildcard certificate, moving a service to a new host, changing deployment pipelines, or receiving an expiration warning.
Use this practical checklist:
- List every active certificate and hostname.
- Confirm the challenge type and responsible ACME client for each item.
- Run a staging or dry-run renewal.
- Verify DNS API permissions and rotate credentials when ownership or scope changes.
- Test
nginx -t, the graceful reload hook, and a real HTTPS health check. - Confirm that expiration alerts reach an owner who can act.
- Document the fallback procedure for a failed renewal or interrupted reload.
For systems deployed through automation, include certificate checks in the same operational review as application releases. The CI/CD deployment troubleshooting matrix is useful when a certificate change intersects with secrets, artifacts, or rollback behavior. If the application runs as a systemd service, pair the renewal test with the service and log checks in the Node.js systemd deployment guide. The goal is not merely to obtain a certificate once; it is to prove, on a recurring schedule, that the entire HTTPS renewal path still works.