Enable post-quantum TLS on nginx
nginx has no post-quantum switch of its own. It uses whatever key exchange groups its OpenSSL library offers, so the work is making sure that library is 3.5 or newer and that nothing in your config narrows the list.
1. Check which OpenSSL nginx runs with
nginx -V 2>&1 | grep -i opensslYou need OpenSSL 3.5 or newer. If the line shows 3.0 to 3.4, nginx cannot offer ML-KEM on this system; see which systems ship OpenSSL 3.5 for the options.
On RHEL 9 and Amazon Linux 2023, OpenSSL is new enough but the system crypto policy leaves post-quantum groups off. Turn them on with sudo update-crypto-policies --set DEFAULT:PQ, then restart nginx.
2. Make sure TLS 1.3 is enabled
ssl_protocols TLSv1.2 TLSv1.3;ML-KEM key exchange only exists in TLS 1.3. Keeping TLS 1.2 alongside it is fine for older clients.
3. Look for a pinned curve list
nginx -T 2>/dev/null | grep ssl_ecdh_curveNo output means nginx uses OpenSSL’s default list, which starts with X25519MLKEM768. With OpenSSL 3.5 you are already done.
A line with only classical curves, such as ssl_ecdh_curve X25519:prime256v1;, is what keeps the site off. Either delete it or put the hybrid group first:
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;Keep the classical curves after it. Clients that don’t support ML-KEM yet still need them, and so does an ECDSA certificate.
4. Test the config and reload
sudo nginx -t && sudo systemctl reload nginxDo not add X25519MLKEM768 on a system with an older OpenSSL. On Ubuntu 24.04 (OpenSSL 3.0) the config test fails and nginx will not start:
[emerg] SSL_CTX_set1_curves_list("X25519MLKEM768:X25519:prime256v1:secp384r1") failed
(SSL: error:0A080106:SSL routines::passed invalid argument:group 'X25519MLKEM768' cannot be set)Check that it worked
Test the site here. The registry offers only post-quantum key exchange, so a pass means the server accepted it.
Try , , ,
Or from a terminal, with OpenSSL 3.5 or newer on your own machine (the openssl that ships with macOS is LibreSSL and won’t work):
openssl s_client -connect example.com:443 -servername example.com \
-groups X25519MLKEM768 </dev/null 2>&1 | grep "Negotiated TLS1.3 group"A ready server prints Negotiated TLS1.3 group: X25519MLKEM768. One that isn’t ends the handshake with alert handshake failure.
To see what real visitors negotiate, add $ssl_curve to your access log format.
What we tested
We ran these settings on 4 December 2026 against nginx 1.31.10 with OpenSSL 3.5.9 (the official Docker image) and checked each with the command above:
- No
ssl_ecdh_curveline: accepted X25519MLKEM768. - The line from step 3: accepted X25519MLKEM768.
ssl_ecdh_curve X25519:prime256v1;: refused it with a handshake failure.- The line from step 3 on Ubuntu 24.04’s nginx 1.24 with OpenSSL 3.0.13: config test failed as shown.
If nginx is behind something else
When a CDN or load balancer terminates TLS in front of nginx, visitors negotiate with that, and this registry tests that. See the Cloudflare and AWS guides. Enabling it on nginx still protects the hop between the two.
Sources
- nginx blog: post-quantum cryptography in nginx
- nginx documentation: ssl_ecdh_curve
- OpenSSL 3.5 release notes
- Red Hat: post-quantum cryptography in RHEL
Last reviewed 4 December 2026.