Guides / Web servers and domains
TLS configuration for nginx, Caddy and Apache (Mozilla guidelines)
Older web server defaults accept TLS 1.0 and 1.1, or ciphers without forward secrecy. Mozilla publishes server-side TLS guidelines with ready configurations. Below is its "intermediate" profile for nginx, Apache and Caddy, tested on Debian 12 and 13, and 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 |
Use intermediate for a public site unless you know that 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. The IETF deprecated TLS 1.0 and 1.1 in 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.
nginx picks the TLS version before it knows which server block the client asked for, so the ssl_protocols of the default server of the address and port (the first block with listen 443, or the one marked default_server) applies to all blocks there. With several sites on one server, set ssl_protocols TLSv1.2 TLSv1.3; in the http block instead. On Debian 12 and Ubuntu 24.04, change the line ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; in /etc/nginx/nginx.conf: a second line in http adds its versions to the first, and nginx -t only warns duplicate value.
Use fullchain.pem instead of 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
By default Caddy allows TLS 1.2 and 1.3 with modern ciphers, gets certificates automatically and sends HTTP/2 and HTTP/3. A site block does not need TLS settings:
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: its TLS stack, including post-quantum key exchange, comes from the Go version it was built with, and changes there reach you with Caddy updates.
Check the result
Test each protocol version with OpenSSL. @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 current 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.
testssl.sh and sslyze test protocols, ciphers, the certificate and known TLS bugs in one run. Run them only against servers you are responsible for.
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, so leave it out. Certificates from authorities that still run OCSP can use it.
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
- Default server and duplicate
ssl_protocolstested on 2026-11-27 with nginx 1.22.1 (Debian 12), 1.24.0 (Ubuntu 24.04) and 1.26.3 (Debian 13) - 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 Vulnpocalypse collector reports the packages and settings of a server once a day, and the digest lists what to fix, most urgent first.
Vulnpocalypse