Guidance Needed – SSL Cipher Suite Configuration for nginx (Ubuntu 24.04)

Hi,

I am running nginx version 1.30.4 on Ubuntu 24.04.4 LTS. I would appreciate it if you could guide me on the ssl_ciphers suite to apply.

cat /etc/nginx/sites-enabled/cbs
server {
    listen 443 ssl;
    http2 on;
    server_name cbs.example.com;

    ssl_certificate /etc/nginx/ssl/full_chain.crt;
    ssl_certificate_key /etc/nginx/ssl/private.key;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ecdh_curve X25519:prime256v1:secp384r1;
    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;


    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    add_header Content-Security-Policy-Report-Only "default-src 'self'; object-src 'none'; base-uri 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; frame-ancestors 'self';" always;
#    add_header Content-Security-Policy "default-src 'self'; object-src 'none'; base-uri 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; frame-ancestors 'self'; connect-src 'self';" always;
    add_header Report-To '{"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"https://cbs.example.com/csp-report"}]}' always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;


    root /opt/web-app/dist/web-app/browser;
    index index.html;


    location = /csp-report {
        access_log /var/log/nginx/csp-report.log;
        return 204;
    }

    location /fineract-provider/ {
        proxy_pass http://localhost:8080/fineract-provider/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 80;
    server_name cbs.example.com;
    return 301 https://$host$request_uri;
}

Please share your comments — I am referring to https://configurator.tlsref.org/ to configure the ssl_ciphers suite.

Best regards,

Kaushal

Your TLS 1.2 cipher list is already in good shape — it’s ECDHE-only (forward secrecy) and exclusively AEAD (AES-GCM and ChaCha20-Poly1305), with no CBC, no RSA key exchange and nothing weak. It effectively matches Mozilla’s “Intermediate” profile bar the DHE suites, which you can safely omit unless you need to serve very old clients. I wouldn’t change it.

A couple of things worth knowing:

  • ssl_ciphers only affects TLS 1.2. The TLS 1.3 suites are negotiated separately and are fixed by OpenSSL (the AES-GCM and ChaCha20 ones); ssl_ciphers has no effect on them. If you ever wanted to tune them you’d use ssl_conf_command Ciphersuites ..., but the OpenSSL defaults are already the right ones, so there’s no need. In short: your cipher line governs 1.2, and 1.3 is already sorted for you.

  • ssl_prefer_server_ciphers off is the right modern choice here. With an all-AEAD list it lets each client pick what suits its hardware — AES-GCM where there’s AES-NI, ChaCha20-Poly1305 on mobile without it. Leaving it off is what current guidance recommends; there’s no need to impose a server order.

For a canonical, maintained reference I’d use Mozilla’s SSL Configuration Generator (https://ssl-config.mozilla.org/) rather than third-party tools, then verify the deployed result with SSL Labs (https://www.ssllabs.com/ssltest/) or testssl.sh.

Optional, non-security: ssl_session_cache shared:SSL:10m; (with a matching ssl_session_timeout) will improve resumption performance for returning clients.

Everything else in the block — ssl_protocols TLSv1.2 TLSv1.3 and the ssl_ecdh_curve list with X25519 first — looks good.

One unrelated heads-up, since you’ve put some care into your security headers: nginx’s add_header doesn’t merge across levels. Headers are inherited from an outer block only if the inner block defines no add_header of its own — the moment a location adds even one header, all the server-level ones silently disappear for that location. Your current config is fine (none of your location blocks add headers), but if you later add, say, a Cache-Control header inside location /, you’d unexpectedly lose HSTS, CSP, X-Content-Type-Options and the rest there. If that day comes, the usual approach is to keep the headers in an included snippet and re-include it wherever you add location-specific ones.