Back to cheatsheets
Web Security
SSL/TLS Configuration
Modern TLS 1.3 configuration for Nginx and Apache with OCSP stapling and forward secrecy.
What you'll learn
- Nginx TLS 1.3
- Apache TLS 1.3
- Check certificate chain
How to use these snippets
- Click the Copy button next to any snippet to copy it to your clipboard.
- Paste the code into your project, IDE, or terminal.
- Replace placeholder values (like
example.comoryour-secret) with your actual data. - Review the code comments for important security notes and caveats.
- Try the interactive related tool to see the concept in action.
Code Snippets
Copy-paste code snippets
3 ready-to-use snippets for ssl/tls configuration. Click copy and paste into your project.
Nginx TLS 1.3
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:
ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_stapling on;
ssl_stapling_verify on;
ssl_ecdh_curve X25519:secp384r1;
Apache TLS 1.3
SSLCProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder off
SSLSessionCache shmcb:/path/to/ssl_scache(512000)
SSLSessionCacheTimeout 86400
SSLUseStapling on
SSLStaplingCache shmcb:/path/to/stapling_cache(128000)
Check certificate chain
# OpenSSL check
openssl s_client -connect example.com:443 \
-servername example.com -showcerts
# Check expiry date
echo | openssl s_client -connect example.com:443 \
2>/dev/null | openssl x509 -noout -dates
Tool
Related ShieldX tool
Try this concept hands-on with the interactive tool.
100% Free · No signup · No cost
Generate something unguessable right now
148 bits of entropy, a crack-time estimate you can trust, and a clipboard that clears itself after 30 seconds.
Part of the Toolly ecosystem · secure.toolly.site