Optimize Server Side TLS

Though Mozilla's guide is good, it's not enough for a really modern site.

Based on Mozilla SSL Config Generator, here are some recommended config files for Apache, Nginx and Caddy.


Protocols h2 http/1.1
SSLProtocol -all +TLSv1.3
SSLCipherSuite TLSv1.3 TLS_AES_256_GCM_SHA384
SSLOpenSSLConfCmd Groups X25519
SSLHonorCipherOrder on
SSLSessionTickets off
SSLUseStapling on
SSLStaplingCache shmcb:ssl_stapling(32768)
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
<VirtualHost *:80>
  ServerName $DOMAIN
  DocumentRoot /path/to/html
  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R=301]
<VirtualHost *:443>
  ServerName $DOMAIN
  DocumentRoot /path/to/html
  SSLEngine on
  SSLCertificateFile /path/to/cert-inter.pem
  SSLCertificateKeyFile /path/to/key.pem


ssl_certificate /path/to/cert-inter.pem;
ssl_certificate_key /path/to/key.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_protocols TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ecdh_curve X25519;
ssl_conf_command Ciphersuites TLS_AES_256_GCM_SHA384;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /path/to/inter-root.pem;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
server {
  listen 80 reuseport;
  return 444;
server {
  listen 80;
  server_name $DOMAIN;
  return 301 https://$host$request_uri;
server {
  listen 443 reuseport ssl http2;
  ssl_reject_handshake on;
server {
  listen 443;
  server_name $DOMAIN;
  root /path/to/html;


	servers {
		protocol {
root * /path/to/html
tls {
	protocols tls1.3
	curves x25519
header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"

It's a pity that you cannot specify TLS 1.3 cipher suites in Caddy. So, you'd better use Apache or Nginx.