How TLS certificates are issued (ACME, HTTP-01, DNS-01)
A TLS certificate is issued through ACME: your client proves it controls the domain by answering a challenge (HTTP-01, DNS-01 or TLS-ALPN-01), then submits a CSR and downloads the signed certificate.
- Updated Nov 27, 2026
- Markdown
Describe each ACME step, pick the right challenge for your setup and recognise why wildcard certificates need DNS-01.
- A basic idea of what HTTPS and a certificate are
A TLS certificate is issued when a certificate authority (CA) is convinced that you control the domain. ACME is the protocol that automates that conversation. Your client, such as certbot or Caddy, asks for a certificate, receives a challenge to prove control of the name, completes it, and downloads the signed result. This lesson walks through each step and the three challenge types so that errors in the logs make sense.
How it works#
The overall flow follows RFC 8555 and is the same for any ACME CA, including Let’s Encrypt:
- Account. The client generates an account key pair and registers it with the CA. The account key signs every later request, so the CA knows who is asking.
- Order. The client says which names it wants a certificate for, such as example.com and www.example.com.
- Authorization. For each name, the CA creates an authorization that lists the challenges it will accept.
- Challenge. The client picks one challenge, publishes the proof, and tells the CA it is ready. The CA checks from the outside, usually from several network vantage points.
- Finalize. Once all names are authorized, the client sends a CSR (certificate signing request). The CSR holds the public key of a fresh key pair and the names. The matching private key stays on your server.
- Download. The CA signs the certificate and the client downloads it as a chain, which you then install. See Certificate chains and intermediates explained.
Certificates are short lived, so the client repeats the process on a schedule. See Renew Let’s Encrypt certificates.
HTTP-01: serve a token over port 80#
In an HTTP-01 challenge the CA gives the client a token. The client makes a file with a response derived from that token and your account key available at:
http://example.com/.well-known/acme-challenge/<token>The CA fetches that URL over plain HTTP on port 80. The response must match, or validation fails. Requirements and traits:
- Port 80 must be reachable from the internet. A firewall that only opens 443 blocks it. Open it in your firewall (for example with ufw).
- The domain must already point at the server running the client or a proxy that forwards that path.
- Redirects to HTTPS are generally followed, but the first request is on port 80. Keep the challenge path reachable. See Redirect HTTP to HTTPS explained.
- It cannot validate wildcard names.
It is the default for most single server setups because it needs no DNS credentials.
DNS-01: publish a TXT record#
For DNS-01 the client creates a TXT record at the challenge name:
_acme-challenge.example.com. 60 IN TXT "<value derived from token and account key>"The CA queries DNS for that record. Traits:
- It is the only way to validate a wildcard name such as
*.example.com. The record for a wildcard goes at_acme-challenge.example.com, the name without the asterisk. - It works for servers that are not reachable from the internet, because the CA only talks to DNS.
- The client needs permission to edit your DNS, usually through an API token from your provider. Use a token limited to that zone, and keep it secret.
- It is slower, since the new TXT record must be visible at the authoritative servers before the CA checks. A short TTL helps, and caches matter, see TTL and DNS caching explained.
- Delegating
_acme-challengeto a separate zone with a CNAME lets a limited account answer challenges without access to the main zone.
TLS-ALPN-01 in brief#
TLS-ALPN-01 validates over port 443. The CA opens a TLS connection using a special protocol identifier (acme-tls/1), and the server answers with a special self signed certificate containing the proof. It needs no port 80 and no DNS access, but the server software has to support it and must be reachable on 443. Caddy is a common client that supports it; certbot does not use it by default. It cannot validate wildcards.
Which challenge for which case#
| Situation | Challenge |
|---|---|
| One public server, port 80 open | HTTP-01 |
| Wildcard certificate | DNS-01 |
| Server not reachable from the internet | DNS-01 |
| Only port 443 is open, client supports it | TLS-ALPN-01 |
| Many servers behind one name | DNS-01 (one place to publish proof) |
For hands on steps, see HTTPS and Let’s Encrypt and Wildcard certificates explained.
Check it worked#
After issuance, inspect what you received:
sudo certbot certificates
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -issuer -subject -datesThe subject and names should be yours, the issuer should be the CA, and the dates show the validity window. See Inspect a TLS certificate with openssl.
To rehearse validation without using up real issuance limits, many clients offer a staging or dry run mode. With certbot, sudo certbot renew --dry-run tests the renewal path.
Edge cases and gotchas#
- Validation from several places: the CA may check from multiple locations, so a firewall that blocks some regions can cause intermittent failures.
- Token path rewrites: a proxy rule or app route that catches every path can swallow
/.well-known/acme-challenge/, so exclude it. - Rate limits: CAs limit failed validations and duplicate certificates. Use staging while testing and check the CA’s published limits rather than assuming numbers.
- CAA records: if the domain has CAA DNS records, they must allow your CA, or issuance is refused.
- DNS caching: an old cached
_acme-challengeTXT value can break DNS-01, so clean up old records and keep the TTL low. - CDN or proxy in front: if a proxy answers port 80 itself, the token never reaches your server. Pass the path through or use DNS-01.
Troubleshooting#
| Symptom | Likely cause | Fix |
|---|---|---|
| Timeout or connection refused during HTTP-01 | Port 80 blocked or nothing listening | Open port 80, stop conflicting services, retry |
| 404 or wrong content at the challenge URL | Proxy or app intercepts the path | Route /.well-known/acme-challenge/ to the client’s webroot |
| DNS problem: NXDOMAIN looking up the name | Domain does not point anywhere yet | Create the A record first and check with dig |
| Wildcard request fails with HTTP-01 | Wildcards need DNS-01 | Switch to the DNS-01 plugin for your DNS provider |
| Incorrect TXT record found | Old or mistyped _acme-challenge value | Delete stale TXT records and retry |
| CAA record forbids issuance | CAA does not list the CA | Add the CA to the CAA record set |
Quick reference#
HTTP-01 port 80 /.well-known/acme-challenge/<token> no wildcards
DNS-01 TXT _acme-challenge.<name> wildcards ok
TLS-ALPN-01 port 443 protocol acme-tls/1 no wildcardssudo certbot certonly --standalone -d example.com # HTTP-01
sudo certbot certificates # list what you haveRelated lessons#
- HTTPS and Let’s Encrypt: get your first certificate with certbot.
- Wildcard certificates explained: the DNS-01 case in practice.
- Certificate chains and intermediates explained: what you download and which file to serve.
- Renew Let’s Encrypt certificates: keep issuance automatic.
- Fix Let’s Encrypt certificate errors: a symptom first checklist.
Next#
Continue with Certificate chains and intermediates explained.
Check what you learned
Frequently asked questions
What is ACME in Let's Encrypt?
ACME (Automatic Certificate Management Environment) is the protocol an ACME client uses to talk to a certificate authority, prove domain control and obtain certificates without manual steps. Certbot and Caddy are ACME clients.
What is the difference between HTTP-01 and DNS-01?
HTTP-01 proves control by serving a token file on port 80 of the domain. DNS-01 proves it by publishing a TXT record at _acme-challenge. Only DNS-01 can validate wildcard names, and it works for servers not reachable from the internet.
Does Let's Encrypt need port 80 open?
Only for HTTP-01. If you use DNS-01 or TLS-ALPN-01 you can validate without port 80, though most setups keep port 80 open anyway for the HTTP to HTTPS redirect.
Does the CA ever see my private key?
No. Your client generates the key on your own machine and sends only a certificate signing request with the public key.
Sources
Keep going: guides and tutorials
- Self-Hosted Static Site Hosting: Deploy a Folder With Levelrail Self-hosted static site hosting from a plain folder: one deploy command, _redirects, _headers and a custom 404 honored, plus a one command rollback.
- Deploy Next.js on a VPS With Docker, Git Push and HTTPS Deploy a Next.js app to your own VPS with Docker, a health check, HTTPS and rollback. Includes the NEXT_PUBLIC build trap that leaves variables empty.