Last active
February 26, 2021 07:57
-
-
Save r0mdau/82b9f91723fc8a91db999baca4320e91 to your computer and use it in GitHub Desktop.
Qualys SSL labs How To get A+ and 100% with Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl deferred; | |
server_name example.com; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_timeout 24h; | |
ssl_buffer_size 4k; | |
ssl_session_tickets off; | |
ssl_protocols TLSv1.2; | |
ssl_ciphers 'AES256+EECDH:AES256+EDH:!aNULL'; | |
ssl_prefer_server_ciphers on; | |
ssl_certificate /path/to/ssl/certificate.crt; | |
ssl_trusted_certificate /path/to/ssl/certificate.crt; | |
ssl_certificate_key /path/to/ssl/certificate.key; | |
ssl_dhparam /path/to/ssl/certs/dhparam.pem; | |
ssl_ecdh_curve secp384r1; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
resolver 8.8.4.4 8.8.8.8 valid=300s; | |
resolver_timeout 10s; | |
index index.html index.php; | |
root /path/to/public/app; | |
} | |
# Init dhparam.pem | |
openssl dhparam -out /path/to/ssl/certs/dhparam.pem 4096 | |
# Better security | |
# I prefer putting this in `nginx.conf` for all vhosts | |
server { | |
... | |
server_tokens off; | |
add_header Strict-Transport-Security "max-age=63072000;"; | |
add_header X-Frame-Options SAMEORIGIN; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-XSS-Protection "1; mode=block"; | |
} |
This is great!
Can you make the same for Apache?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ssl directives details :
http://nginx.org/en/docs/http/ngx_http_ssl_module.html
resolver directives details :
http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver