ssl-guides 2026-12-02 ⏱ 3 min read

Best TLS Configuration for Nginx and Apache

Best TLS Configuration for Nginx and Apache
Quick Answer: The best TLS configuration enables TLS 1.2 and TLS 1.3 only, use modern forward-secret ciphers, send the full certificate chain, add HSTS once HTTPS is stable, and staple OCSP only if your CA still publishes an OCSP responder. Then test the result instead of trusting the config.

Protocols

ProtocolRecommendation
SSL 2.0 / 3.0Disable, broken
TLS 1.0 / 1.1Disable, deprecated and rejected by modern browsers
TLS 1.2Enable, wide compatibility
TLS 1.3Enable, faster and simpler with strong defaults

Nginx TLS configuration

server {
    listen 443 ssl;
    http2 on;
    server_name example.com;

    ssl_certificate     /etc/ssl/example.com/fullchain.pem;
    ssl_certificate_key /etc/ssl/example.com/privkey.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers off;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1d;
    ssl_session_tickets off;

    add_header Strict-Transport-Security "max-age=31536000" always;
}

The stapling lines are left out on purpose. Let's Encrypt dropped OCSP URLs from its certificates on 7 May 2025 (Let's Encrypt OCSP announcement), so there is nothing to staple. If your CA still lists an OCSP responder, add ssl_stapling on;, ssl_stapling_verify on; and a resolver line. The http2 on; directive needs a recent Nginx. On older versions put http2 after ssl in the listen line.

Apache TLS configuration

SSLEngine on
SSLCertificateFile    /etc/ssl/example.com/cert.pem
SSLCertificateKeyFile /etc/ssl/example.com/privkey.pem
SSLCertificateChainFile /etc/ssl/example.com/chain.pem

SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder off
Header always set Strict-Transport-Security "max-age=31536000"

If your CA still lists an OCSP responder, you can add SSLUseStapling on, which also needs an SSLStaplingCache line in the main server configuration. Let's Encrypt certificates do not need it.

Ciphers

TLS 1.3 chooses its own safe suites. For TLS 1.2 prefer ECDHE key exchange with AES-GCM or ChaCha20-Poly1305, and avoid RC4, 3DES and static RSA key exchange. Use a maintained configuration generator or your distribution's current defaults, which is better than copying an old blog snippet.

Certificates and chain

  • Send the leaf plus intermediates, not the root.
  • RSA 2048 or ECDSA P-256 keys are standard choices.
  • Renew automatically, when about a third of the lifetime is left. See Certbot automation and what is coming in the 47-day lifetime roadmap.

Need a certificate? You can issue a free one on TryFreeSSL.com.

Test it

  1. Run the TLS Checker to see which protocol versions and ciphers your server accepts.
  2. Run the SSL Checker for the certificate and chain.
  3. Run Security Headers for HSTS and friends.
  4. Test from openssl s_client -connect example.com:443 -tls1_2 to confirm a specific version.

Related reading: configuring SSL on HAProxy.

FAQ

Should I disable TLS 1.2?

Not yet for public sites. Some clients still need it. TLS 1.3 only is reasonable for controlled environments.

Do I need HSTS preload?

No. It is optional and hard to reverse, so only use it when every subdomain is HTTPS.

What does OCSP stapling do?

The server attaches a recent revocation status to the handshake, so clients do not need to query the CA. It only works for certificates that list an OCSP responder. Let's Encrypt dropped OCSP URLs on 7 May 2025 and turned off its responders on 6 August 2025 (Let's Encrypt OCSP announcement). See OCSP Stapling Explained: Do You Still Need It?

Will strict settings break old devices?

Very old systems may fail. Check your analytics before dropping anything that real users still rely on.

🔐 Test Your Server TLS 1.3 & Cipher Support
Test TLS 1.3 →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

Free SSL Certificates, Live SSL Checker & CSR Generator

Issue trusted Let's Encrypt SSL certificates in 60 seconds with zero server setup.

Related Articles

🤖 TryFreeSSL AI Assistant