Chapter 4 — TLS and Certificates
4.1 Certificate store and files
TLS material is split across three locations; site configuration never stores a private key directly:
| Path | Purpose |
|---|---|
conf/cert.toml |
Index: name → files, domains, issuer, expiry, source |
conf/certs/ |
Certificates and keys, usually <name>.crt / <name>.key |
conf/acme.toml |
ACME policy and DNS credentials; mode 0600 |
cert.toml entries are maintained by the console or by ACME:
certs = {
example-com = {
cert_file = "certs/example-com.crt",
key_file = "certs/example-com.key",
domains = ["example.com", "www.example.com"],
source = "acme",
},
}
Sites reference it by name: ssl = { cert = "example-com" }; cert wins
over cert_file / key_file.
4.2 Enabling HTTPS on a site
http = {
servers = [
{
domain = ["example.com"],
listen = [{ addr = ":443", ssl = true, http2 = true }],
ssl = { cert = "example-com" },
},
],
}
For HTTP/3, add http3 = true to listen (it requires ssl = true); the
server then listens for QUIC on UDP on the same port. Certificate paths
resolve relative to the main config directory. The master hands certificates
to workers through inherited descriptors; workers never walk conf/certs.
4.3 Protocols, sessions and mTLS
| Key | Default | Description |
|---|---|---|
protocols |
TLS1.2 and later | e.g. ["TLS1.2","TLS1.3"] |
ciphers |
rustls defaults | OpenSSL-name subset, e.g. ECDHE-RSA-AES128-GCM-SHA256 |
session_cache |
false | TLS session resumption |
client_cert_file |
— | Client CA chain; required for mTLS |
verify_client |
off |
on enforces, optional requests; enables $ssl_client_* |
A failed mTLS verification rejects the handshake. With verify_client
enabled, the client certificate subject, serial number and result can be
logged.
4.4 ACME automatic certificates
Each automatic certificate corresponds to a certs.<name> table in
conf/acme.toml. Ordinary domains can use HTTP-01; wildcards require
DNS-01:
certs = {
example-com = {
domains = ["example.com", "*.example.com"],
email = "ops@example.com",
challenge = "dns",
auto_renew = true,
key_type = "ec256",
dns = { provider = "cloudflare", credentials = { api_token = "..." } },
},
}
Providers: cloudflare, alidns (Alibaba Cloud), tencentcloud
(DNSPod), route53 (AWS). challenge is auto, http or dns;
renew_before_days defaults to 30, check_interval_hours to 12. HTTP-01
needs public port 80; the embedded server owns 443, so TLS-ALPN-01 is
unavailable.
The console’s “TLS certificate store → ACME certificates” view shows the
valid, missing, expired, issuing and error states and can issue or
renew immediately. Deleting an ACME entry only stops renewal; issued
certificates are kept. A certificate still referenced by a site cannot be
removed from the store.
4.5 Uploads, renewal and permissions
When uploading, the PEM may contain only the leaf. If the CA or an
intermediate is separate, put it in the “CA / intermediate chain” field;
the server orders and de-duplicates by AuthorityKeyId / Issuer: leaf
→ intermediate → root. The key must match the leaf or the upload is
rejected.
After successful issuance the certificate is written to conf/certs/ and
cert.toml is updated. Renewals are pushed to workers over the internal
control socket; no restart is needed. Permissions: private keys
0600 root:root, certificates 0644 root:root, conf/certs/
0700 root:root, and cert.toml 0640 root:<worker group>. Only the
master reads acme.toml, so even a compromised worker cannot obtain the DNS
credentials.
4.6 HTTP/2 and HTTP/3 switches
Like HTTPS, HTTP/2 and HTTP/3 are enabled per listen entry: set
ssl = true together with http2 = true / http3 = true on that listen;
omitting the flag means disabled. Global or site-level http2 = false /
http3 = false is a hard off switch. Changes apply to new connections after
reload. See Chapter 9.