Guides / Web servers and domains
TLS configuration for nginx, Caddy and Apache (Mozilla guidelines)
A web server accepts what its TLS configuration allows. Old defaults still accept TLS 1.0 and 1.1 or ciphers without forward secrecy. Mozilla publishes server-side TLS guidelines with ready configurations. Its "intermediate" profile for nginx, Apache and Caddy is below, tested on Debian 12 and 13, with a command that shows what a server accepts.
Which profile
Version 6.0 of the Mozilla guidelines (current in November 2026) has two profiles:
| Profile | Protocols | Oldest clients it supports |
|---|---|---|
| Modern | TLS 1.3 only | Firefox 63, Chrome 70, Safari 12.1, Android 10, Java 11, OpenSSL 1.1.1 |
| Intermediate | TLS 1.2 and 1.3 | Firefox 31.3, Chrome 49, Safari 9, Android 4.4.2, IE 11 on Windows 10, Java 8u161 |
Intermediate is the right choice for a public site unless you know all clients support TLS 1.3. Both profiles use only ECDHE key exchange with AEAD ciphers (AES-GCM, ChaCha20-Poly1305), so every connection has forward secrecy. TLS 1.0 and 1.1 have been deprecated by the IETF since 2021 (RFC 8996).
The key exchange groups in version 6.0 start with X25519MLKEM768, a hybrid post-quantum group. It needs OpenSSL 3.5 or newer: Debian 13 has it, Debian 12 (OpenSSL 3.0) does not, and nginx on Debian 12 refuses to start with it in the list:
[emerg] SSL_CTX_set1_curves_list("X25519MLKEM768:X25519:prime256v1:secp384r1") failed
(SSL: error:0A080106:SSL routines::passed invalid argument:group 'X25519MLKEM768' cannot be set)
On Debian 12, leave it out.
nginx
Inside the server block (tested with nginx 1.26.3 on Debian 13 and 1.22.1 on Debian 12):
server {
listen 443 ssl;
http2 on; # nginx 1.25.1+; on 1.22 use "listen 443 ssl http2;"
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1; # Debian 12: X25519:prime256v1:secp384r1
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
}
ssl_ciphers applies to TLS 1.2; for TLS 1.3, OpenSSL uses its default suites, which are all AEAD ciphers. Test with sudo nginx -t, then sudo systemctl reload nginx.
Use fullchain.pem, not cert.pem, so the server sends the intermediate certificate too; a missing intermediate is a common cause of chain errors.
Apache httpd
Tested with Apache 2.4 on Debian 12, with a2enmod ssl headers http2:
<VirtualHost *:443>
ServerName example.com
Protocols h2 http/1.1
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLOpenSSLConfCmd Curves X25519:prime256v1:secp384r1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
SSLHonorCipherOrder off
SSLSessionTickets off
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>
Check with sudo apache2ctl -t (Debian, Ubuntu) or sudo apachectl -t (RHEL family).
Caddy
Caddy defaults to TLS 1.2 and 1.3 with modern ciphers, gets certificates automatically and sends HTTP/2 and HTTP/3. A site block needs nothing for TLS:
example.com {
root * /srv/site
file_server
header Strict-Transport-Security "max-age=63072000; includeSubDomains"
}
To allow TLS 1.3 only, add tls { protocols tls1.3 } inside the block. Caddy is a Go program: the TLS stack, including post-quantum key exchange, comes with the Go version it was built with. Keep Caddy current to get those changes.
Check the result
Which protocol versions does the server accept? Test each one with OpenSSL. The @SECLEVEL=0 lets the client offer the old versions at all, so a refusal comes from the server:
host=example.com
for v in tls1 tls1_1 tls1_2 tls1_3; do
if openssl s_client -connect "$host:443" -servername "$host" -"$v" -cipher 'DEFAULT:@SECLEVEL=0' </dev/null >/dev/null 2>&1
then echo "$v accepted"; else echo "$v refused"; fi
done
tls1 refused
tls1_1 refused
tls1_2 accepted
tls1_3 accepted
What a modern client negotiates:
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
| grep -E 'Protocol|Cipher is|Negotiated TLS1.3 group|Server Temp Key'
On the nginx test server on Debian 13 this showed TLSv1.3, TLS_AES_256_GCM_SHA384 and Negotiated TLS1.3 group: X25519MLKEM768.
For a full report, tools such as testssl.sh and sslyze test protocols, ciphers, certificate and known TLS bugs. Run them only against servers you are responsible for.
About OCSP stapling
The Mozilla configurations enable OCSP stapling. Let's Encrypt stopped putting OCSP URLs into certificates on 2025-05-07 and turned off its OCSP responders on 2025-08-06. With a Let's Encrypt certificate, stapling does nothing and nginx logs a warning that ssl_stapling was ignored; leave it out. With certificates from other authorities that still run OCSP, it remains useful.
Sources
- Mozilla server side TLS guidelines 6.0, JSON and the configuration generator (profiles, oldest clients, ciphers, groups, HSTS max-age 63072000)
- RFC 8996: Deprecating TLS 1.0 and TLS 1.1
- nginx: ngx_http_ssl_module, ngx_http_v2_module (
http2directive) - Apache mod_ssl
- Caddy: tls directive (default protocols)
- Let's Encrypt: Ending OCSP Support in 2025
- Configurations tested on 2026-11-26: nginx 1.26.3 with OpenSSL 3.5.9 (
debian:trixie-20261123-slim), nginx 1.22.1 and Apache 2.4.71 with OpenSSL 3.0.22 (debian:bookworm-20261027-slim), Caddy 2.6.2 from Debian 13
Check your servers every day
The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.