How to enable post-quantum TLS on Nginx
Checked · Official docs
Works when Nginx is built against OpenSSL 3.5+; on by default there unless ssl_ecdh_curve overrides it.
When Nginx faces the internet directly, it negotiates TLS with every visitor, so the change belongs in its TLS configuration. If a CDN or load balancer sits in front, fix that first: it is what visitors connect to. The hybrid falls back to classical X25519 for clients that don't support it, so turning it on doesn't break older browsers.
Turn on post-quantum key exchange
Run Nginx on OpenSSL 3.5 or newer. This needs OpenSSL 3.5 or newer (check with openssl version, or nginx -V / httpd -V for what the server was built with). Debian 13, Ubuntu 25.10+, Alpine 3.22+ and Fedora 42+ ship it. Then make sure the group list includes the hybrid:
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;
Prefer post-quantum over classical
Put the hybrid group first:
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;
Enable TLS 1.3
Allow TLS 1.3:
ssl_protocols TLSv1.2 TLSv1.3;
Turn off TLS 1.0 and 1.1
Allow only TLS 1.2 and 1.3:
ssl_protocols TLSv1.2 TLSv1.3;
Use strong TLS 1.2 cipher suites
Use strong TLS 1.2 suites:
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;
Redirect HTTP to HTTPS
Add a port 80 server that redirects:
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}Send HSTS
Send HSTS on every HTTPS response:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Check that it worked
After you deploy, rescan your domain. A quantum-safe setup shows X25519MLKEM768 as the negotiated key exchange. From a terminal:
curl qsafe.sh/your-domain.com?fresh
Prefer to let an AI agent make the change? The qsafe-fix skill and the MCP server use this same guide. It's also available as JSON from /api/v1/fixes/nginx.