Skip to content

Instantly share code, notes, and snippets.

Last active October 20, 2015 11:39
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Nginx TLS configuration
server {
listen 80;
return 301 https://$host$request_uri;
server {
listen 443 ssl default_server;
ssl on;
# ocsp
ssl_stapling on;
ssl_stapling_verify on;
resolver valid=300s;
resolver_timeout 5s;
# intermedia certificates concatenated with server certificate
ssl_certificate /etc/ssl/private/;
ssl_certificate_key /etc/ssl/private/;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/private/dhparams.pem;
# hpkp, see how to get base64 hashes for your certificates
add_header Public-Key-Pins 'pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includeSubDomains';
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
# hsts, see
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
location / {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment