nginx: TLS 1.3 only, ECDSA only, HSTS with subdomains
We ran this exact config. Tested on nginx 1.31 with OpenSSL 4.1, on 3 Dec 2026, with test certificates.
Needs nginx 1.25.1 or later, built with OpenSSL 3.5 or later for the post-quantum group. The TLS lines go in the http block. Swap example.com and the paths for your own.
# Don't put the nginx version in headers or error pages.
server_tokens off;
# TLS settings sit here, outside any server block, so every server gets them.
# nginx picks the key exchange group before it knows which hostname was asked
# for, so a group list inside one server block can be silently ignored.
# TLS 1.3 only.
ssl_protocols TLSv1.3;
# Hybrid post-quantum key exchange first. No P-256.
ssl_ecdh_curve X25519MLKEM768:X25519:secp384r1;
# No session tickets and no 0-RTT.
ssl_session_tickets off;
ssl_early_data off;
# Plain HTTP: redirect to HTTPS on the same hostname.
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$host$request_uri;
}
# Any other hostname that reaches this server: refuse the handshake, so a
# scanner that connects by IP address doesn't get your certificate.
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name example.com;
ssl_certificate /etc/ssl/example.com/fullchain.pem;
ssl_certificate_key /etc/ssl/example.com/privkey.pem;
# "always" sends these on error pages too. A location block with its own
# add_header drops all of these, so repeat them there.
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
root /var/www/example.com;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
What it does
- Accepts TLS 1.3 only. See protocol versions.
- Offers the hybrid post-quantum group first, then X25519 and P-384. P-256 is not offered. See post-quantum key exchange.
- Expects one ECDSA P-384 certificate. See certificate strength.
- Sends HSTS for this hostname and every subdomain. Be sure all of them serve HTTPS first. See HSTS.
- Turns session tickets and 0-RTT off. See 0-RTT and session tickets.
What it leaves out
- OCSP stapling. See revocation.
- A Content-Security-Policy. It depends on what your pages load.
- HTTP/3. We haven't tested it.
Check what you deployed
openssl s_client -connect example.com:443 -groups X25519MLKEM768 -brief </dev/null
weeb probe example.com --fix
The first should print Negotiated TLS1.3 group: X25519MLKEM768. The second (get weeb) should show TLS 1.0 and 1.1 as unavailable, and TLS 1.2 too.