isquantumsafe Check a domain

isquantumsafe / Guides / nginx

Post-quantum TLS on nginx

Enable X25519MLKEM768 hybrid post-quantum key exchange (ML-KEM) on nginx: OpenSSL 3.5 requirement, the ssl_ecdh_curve setting, and how to test the result.

Default
Partly on by default
You need
nginx built with OpenSSL 3.5.0 or newer
Updated
4 December 2026 · 4 sources

nginx negotiates X25519MLKEM768 by default only when it is linked against OpenSSL 3.5 or newer, because the default ssl_ecdh_curve auto hands the choice to OpenSSL and OpenSSL 3.5 prefers hybrid ML-KEM groups. If your nginx is linked against OpenSSL 3.0 to 3.4, you need a newer build first; no nginx setting can add the group on its own.

Requirements

  • OpenSSL 3.5.0 or newer linked into nginx. OpenSSL 3.5.0 was released on 8 April 2025 and changed the default groups to include and prefer hybrid PQC groups.
  • TLS 1.3 enabled. nginx has enabled TLS 1.3 by default since 1.23.4.
  • Distributions that ship OpenSSL 3.5 or newer, per the NGINX blog: Debian 13, Alpine 3.22, RHEL/Alma/Rocky 10.1 and SLES 16. Debian 12, Ubuntu 22.04 and Ubuntu 24.04 ship older OpenSSL.
  • Check what your binary uses with nginx -V. The line "built with OpenSSL 3.5.x" is what counts, not the output of openssl version.

Enable it

If you have never set ssl_ecdh_curve, you are done once nginx runs on OpenSSL 3.5+. To make the order explicit, put this in the http block or in each server block that listens with ssl:

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;

This lists the hybrid group first and keeps X25519 and P-256 for clients that do not support ML-KEM. Reload with nginx -t && nginx -s reload.

If you also serve an ECDSA certificate on P-384, add secp384r1 to the list. The nginx docs note that the curve list must include the curves your certificates use.

Check it worked

From a machine with an OpenSSL 3.5 or newer client:

openssl s_client -connect example.com:443 -servername example.com \
  -groups X25519MLKEM768 -tls1_3 </dev/null 2>/dev/null | grep -i "group"

A working server prints Negotiated TLS1.3 group: X25519MLKEM768. To see the group per request in your logs, add the $ssl_curve variable to a log_format.

Run a free check at https://isquantumsafe.net/ to see the negotiated group and your grade.

Common problems

  • nginx will not start after the change. nginx -t fails with SSL_CTX_set1_curves_list(...) failed. Your nginx is linked against OpenSSL older than 3.5, which does not know the group name.
  • An old curve list overrides the default. A line such as ssl_ecdh_curve X25519:prime256v1; copied from an older hardening guide replaces the OpenSSL default list and silently turns ML-KEM off. Remove it or add X25519MLKEM768 first.
  • TLS 1.2 only. Hybrid groups exist only in TLS 1.3. If ssl_protocols lists only TLSv1.2, no client can negotiate ML-KEM.
  • Large ClientHello. The hybrid key share makes the client's first message larger than one packet. The OpenSSL manual warns that some firewalls mishandle this and cause timeouts. Test from outside your network if clients report hangs.

Sources

  1. Post-Quantum Cryptography (PQC) support in NGINX (NGINX blog)
  2. Module ngx_http_ssl_module (nginx.org)
  3. OpenSSL 3.5 Series Release Notes
  4. SSL_CTX_set1_groups (OpenSSL 3.5 manual)

Other guides: Web servers