Skip to content

Instantly share code, notes, and snippets.

@xXPhenomXx
Forked from gavinhungry/nginx-tls.conf
Created June 14, 2018 18:16
Show Gist options
  • Save xXPhenomXx/04e45823ba3540f5b3acbcf7c48b8f23 to your computer and use it in GitHub Desktop.
Save xXPhenomXx/04e45823ba3540f5b3acbcf7c48b8f23 to your computer and use it in GitHub Desktop.

Revisions

  1. @gavinhungry gavinhungry revised this gist Apr 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ server {
    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8; # google-public-dns-a.google.com
    resolver 1.1.1.1; # 1dot1dot1dot1.cloudflare-dns.com

    # Set HSTS to 365 days
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always;
  2. @gavinhungry gavinhungry revised this gist Apr 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    # Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
    # to SSL/TLS are omitted here.
    #
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gav.sh
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
    #

    server {
  3. @gavinhungry gavinhungry revised this gist Mar 2, 2018. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@
    # Auth: Gavin Lloyd <[email protected]>
    # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
    #
    # Enables SPDY, PFS, HSTS and OCSP stapling. Configuration options not related
    # Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
    # to SSL/TLS are omitted here.
    #
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gav.sh
    #

    server {
    @@ -19,8 +19,8 @@ server {
    }

    server {
    listen [::]:443 default_server ssl spdy;
    listen 443 default_server ssl spdy;
    listen [::]:443 default_server ssl http2;
    listen 443 default_server ssl http2;

    server_name domain.tld www.domain.tld;

    @@ -31,7 +31,7 @@ server {
    # openssl dhparam 4096 -out /etc/ssl/dhparam.pem
    ssl_dhparam /etc/ssl/dhparam.pem;

    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;

    @@ -40,8 +40,8 @@ server {
    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8;
    resolver 8.8.8.8; # google-public-dns-a.google.com

    # Set HSTS to 365 days
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always;
    }
  4. @gavinhungry gavinhungry revised this gist Sep 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ server {
    # Certificate(s) and private key
    ssl_certificate /etc/ssl/domain.crt;
    ssl_certificate_key /etc/ssl/domain.key;

    # openssl dhparam 4096 -out /etc/ssl/dhparam.pem
    ssl_dhparam /etc/ssl/dhparam.pem;

  5. @gavinhungry gavinhungry revised this gist Sep 7, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,9 @@ server {
    # Certificate(s) and private key
    ssl_certificate /etc/ssl/domain.crt;
    ssl_certificate_key /etc/ssl/domain.key;
    ssl_dhparam /etc/ssl/dhparam.pem; # openssl dhparam 4096 -out /etc/ssl/dhparam.pem

    # openssl dhparam 4096 -out /etc/ssl/dhparam.pem
    ssl_dhparam /etc/ssl/dhparam.pem;

    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
  6. @gavinhungry gavinhungry revised this gist Sep 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@
    #
    # Name: nginx-tls.conf
    # Auth: Gavin Lloyd <[email protected]>
    # Date: 02 May 2014
    # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
    #
    # Enables SPDY, PFS, HSTS and OCSP stapling. Configuration options not related
    @@ -28,6 +27,7 @@ server {
    # Certificate(s) and private key
    ssl_certificate /etc/ssl/domain.crt;
    ssl_certificate_key /etc/ssl/domain.key;
    ssl_dhparam /etc/ssl/dhparam.pem; # openssl dhparam 4096 -out /etc/ssl/dhparam.pem

    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
  7. @gavinhungry gavinhungry revised this gist Feb 3, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,7 @@ server {

    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8;

    # Set HSTS to 365 days
  8. @gavinhungry gavinhungry revised this gist Feb 3, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ server {

    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;

    ssl_session_cache shared:TLS:2m;

  9. @gavinhungry gavinhungry revised this gist Feb 3, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ server {

    # OCSP stapling
    ssl_stapling on;
    resolver 74.207.241.5; # resolver1.fremont.linode.com
    resolver 8.8.8.8;

    # Set HSTS to 365 days
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
  10. @gavinhungry gavinhungry revised this gist May 2, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@
    # Date: 02 May 2014
    # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
    #
    # Enables PFS, HSTS and OCSP stapling. Configuration options not related to
    # SSL/TLS are omitted here.
    # Enables SPDY, PFS, HSTS and OCSP stapling. Configuration options not related
    # to SSL/TLS are omitted here.
    #
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
    #
  11. @gavinhungry gavinhungry revised this gist May 2, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -39,6 +39,6 @@ server {
    ssl_stapling on;
    resolver 74.207.241.5; # resolver1.fremont.linode.com

    # Set HSTS to 180 days
    add_header Strict-Transport-Security 'max-age=15552000';
    # Set HSTS to 365 days
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
    }
  12. @gavinhungry gavinhungry revised this gist May 2, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,6 @@ server {
    ssl_certificate /etc/ssl/domain.crt;
    ssl_certificate_key /etc/ssl/domain.key;

    # Allow only select protocols and ciphers
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
  13. @gavinhungry gavinhungry revised this gist May 2, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,8 @@
    # Date: 02 May 2014
    # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
    #
    # Configuration options not related to SSL/TLS are omitted
    # Enables PFS, HSTS and OCSP stapling. Configuration options not related to
    # SSL/TLS are omitted here.
    #
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
    #
  14. @gavinhungry gavinhungry created this gist May 2, 2014.
    44 changes: 44 additions & 0 deletions nginx-tls.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #
    # Name: nginx-tls.conf
    # Auth: Gavin Lloyd <[email protected]>
    # Date: 02 May 2014
    # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
    #
    # Configuration options not related to SSL/TLS are omitted
    #
    # Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
    #

    server {
    listen [::]:80;
    listen 80;
    server_name domain.tld www.domain.tld;

    # Redirect all non-https requests
    rewrite ^ https://$host$request_uri? permanent;
    }

    server {
    listen [::]:443 default_server ssl spdy;
    listen 443 default_server ssl spdy;

    server_name domain.tld www.domain.tld;

    # Certificate(s) and private key
    ssl_certificate /etc/ssl/domain.crt;
    ssl_certificate_key /etc/ssl/domain.key;

    # Allow only select protocols and ciphers
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_prefer_server_ciphers on;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;

    ssl_session_cache shared:TLS:2m;

    # OCSP stapling
    ssl_stapling on;
    resolver 74.207.241.5; # resolver1.fremont.linode.com

    # Set HSTS to 180 days
    add_header Strict-Transport-Security 'max-age=15552000';
    }