Enable post-quantum key exchange on nginx
nginx gets hybrid post-quantum key exchange (X25519MLKEM768) from OpenSSL. With OpenSSL 3.5 or newer it is on by default. With anything older, no nginx setting can turn it on.
Check your OpenSSL version before you touch any config. We tested this: on OpenSSL 3.0, adding X25519MLKEM768 to your nginx config makes nginx refuse to start.
1. Check which OpenSSL nginx uses
nginx -V 2>&1 | grep -i openssl
Look for the version after "running with" (or "built with"). You need 3.5 or newer.
- 3.5 or newer: go to step 3.
- Older than 3.5: go to step 2.
2. Upgrade to OpenSSL 3.5 or newer
The safe way is to move to an operating system release that ships it, rather than installing OpenSSL by hand. We tested Ubuntu 26.04 LTS: it ships OpenSSL 3.5.5 and nginx 1.28.3. Ubuntu 24.04 ships OpenSSL 3.0, which cannot do this.
- Take a snapshot or backup of the server first.
- Upgrade the release (on Ubuntu:
sudo do-release-upgrade), or build a new server on the newer release and move your site across. - For other systems, check your distribution's OpenSSL version. Anything 3.5 or newer works.
Not comfortable doing a release upgrade on a live server? This is a good job to hand to whoever manages your hosting.
3. Look for a line that blocks it
Many configurations copied from older guides or generators set their own list of key exchange groups. That list overrides OpenSSL's defaults, and if it leaves out X25519MLKEM768 your site stays classical even on OpenSSL 3.5. We tested that too.
sudo grep -R "ssl_ecdh_curve" /etc/nginx/
- No results: nothing to change. Go to step 4.
- A line such as
ssl_ecdh_curve X25519:prime256v1:secp384r1;(orsecp384r1on its own): replace it with the line below.
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;
This puts the hybrid group first and keeps the classical groups for older browsers.
4. Test the config, then reload
sudo nginx -t && sudo systemctl reload nginx
Only reload if the test says "successful". If it reports group 'X25519MLKEM768' cannot be set, nginx is still on an older OpenSSL: undo the change and go back to step 2.
5. Check the result
Run the free check again. If your domain has several servers behind it, update every one of them: Kexwatch tests each address separately.
Tested 3 December 2026 with the Kexwatch probe: nginx 1.24 on OpenSSL 3.0 (Ubuntu 24.04), and OpenSSL 3.5.5 defaults and group settings on Ubuntu 26.04.