Skip to content

Post-quantum TLS on Nginx

Web server. Works when Nginx is built against OpenSSL 3.5+; on by default there unless ssl_ecdh_curve overrides it.

Checked 2026-12-05. Official docs: nginx.org. JSON: /api/v1/fixes/nginx

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:

nginx.conf, http or server block
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;

Fixes: KEX_CLASSICAL_ONLY

Prefer post-quantum over classical

Put the hybrid group first:

nginx.conf, http or server block
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;

Fixes: KEX_PQ_NOT_PREFERRED

Enable TLS 1.3

Allow TLS 1.3:

nginx.conf, http or server block
ssl_protocols TLSv1.2 TLSv1.3;

Fixes: TLS13_MISSING

Turn off TLS 1.0 and 1.1

Allow only TLS 1.2 and 1.3:

nginx.conf, http or server block
ssl_protocols TLSv1.2 TLSv1.3;

Fixes: TLS10_11_ENABLED

Use strong TLS 1.2 cipher suites

Use strong TLS 1.2 suites:

nginx.conf, http or server block
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;

Fixes: TLS12_WEAK_SUITE

Redirect HTTP to HTTPS

Add a port 80 server that redirects:

nginx.conf
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}

Fixes: HTTP_NO_REDIRECT

Send HSTS

Send HSTS on every HTTPS response:

nginx.conf, server block on port 443
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

Fixes: HSTS_MISSING, HSTS_SHORT