Skip to content

Instantly share code, notes, and snippets.

Last active August 8, 2023 08:39
Show Gist options
  • Save konklone/6532544 to your computer and use it in GitHub Desktop.
Save konklone/6532544 to your computer and use it in GitHub Desktop.
nginx TLS / SSL configuration options for
# Basically the nginx configuration I use at
# I check it using
# To provide feedback, please tweet at @konklone or email
# Comments on gists don't notify the author.
# Thanks to WubTheCaptain ( for his help and ciphersuites.
# Thanks to Ilya Grigorik ( for constant inspiration.
server {
listen 80;
return 301 https://$host$request_uri;
server {
# 'http2' requires nginx 1.9.5+. If using older nginx, replace with 'spdy'.
listen 443 ssl http2;
# Path to certificate and intermediates, *omitting* the root.
ssl_certificate /path/to/;
# Path to private key used to create certificate.
ssl_certificate_key /path/to/;
# HTTP Strict Transport Security: tells browsers to require https:// without first checking
# the http:// version for a redirect. Warning: it is difficult to change your mind.
# max-age: length of requirement in seconds (31536000 = 1 year)
# includeSubdomains: force TLS for *ALL* subdomains (remove if this is not what you want)
# preload: indicates you want browsers to ship with HSTS preloaded for your domain.
# Submit your domain for preloading in browsers at:
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
# If you won't/can't turn on HTTPS for *all* subdomains, use this simpler version:
# add_header Strict-Transport-Security 'max-age=31536000';
ssl_prefer_server_ciphers on;
# This requires strong forward secrecy (ECDHE) for all connections.
# However, it blocks IE8+XP and Android 2.3.
# Uncomment to require strong forward secrecy (ECDHE) in most clients, with a
# non-FS exception (DES-CBC3-SHA) for IE8/XP, and plain DHE for Android 2.3 users.
# Allows all modern and legacy clients to connect over TLS.
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
# Uncomment for only the latest TLS, if you can drop IE8-IE10 and Android 4.3.
# ssl_protocols TLSv1.2;
# Turn on session resumption, using a 10 min cache shared across nginx processes,
# as recommended by
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 70;
# OCSP stapling: nginx will poll the CA for signed OCSP responses, and
# send them to clients so clients don't make their own OCSP calls.
# The ssl_trusted_certificate is a chain of intermediates *including* the
# root certificate, and *excluding* the cert for your domain.
# See
ssl_stapling on;
ssl_stapling_verify on;
resolver valid=86400;
resolver_timeout 10;
ssl_trusted_certificate /path/to/;
Copy link

Fantastic SSL config and discussion here, thanks guys... we used some of your suggestions in our SlickStack settings:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment