Last active
March 20, 2016 01:27
-
-
Save eby/3bc14741c9a8db16f897 to your computer and use it in GitHub Desktop.
Docstore Sample Nginx Config
This file contains hidden or 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
# Redirect all traffic to SSL | |
server { | |
listen [::]:80; | |
listen 80; | |
server_name docstore.yourdomain.org; | |
return 301 https://$server_name$request_uri; | |
} | |
# SSL Server based off https://cipherli.st/ | |
server { | |
# Listen on IPv6/4 | |
listen [::]:443 ssl spdy; | |
listen 443 ssl spdy; | |
server_name docstore.yourdomain.org; | |
access_log /var/log/nginx/docstore_access_log main; | |
error_log /var/log/nginx/docstore_error_log info; | |
root /path/to/docstore; | |
# Tweak for what you want max upload size to be | |
client_max_body_size 2G; | |
# SSL Configuration | |
# This will get A- or A+ depending on cipher list on ssllabs | |
# You'll want a SHA2 cert | |
ssl_certificate /etc/ssl/nginx/yourssl.crt; | |
ssl_certificate_key /etc/ssl/private/yourssl.key; | |
# Generate with 'openssl dhparam -out dhparams.pem 4096' | |
ssl_dhparam /etc/ssl/nginx/dhparams.pem; | |
# Disable SSLv2 and SSLv3 due to attacks | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0 | |
ssl_prefer_server_ciphers on; | |
# Ciphers if you want A+ SSLLabs rating but don't mind <IE11 not being able to connect | |
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; | |
# Ciphers if you want to support IE8/XP (will be A-) | |
# ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; | |
# Some SSL options for performance and security | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_tickets off; # Requires nginx >= 1.5.9 | |
ssl_stapling on; # Requires nginx >= 1.3.7 | |
ssl_stapling_verify on; # Requires nginx => 1.3.7 | |
resolver 8.8.8.8 8.8.4.4 valid=300s; | |
resolver_timeout 5s; | |
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; | |
add_header X-Frame-Options DENY; | |
add_header X-Content-Type-Options nosniff; | |
location ^~ /static/ { | |
if ($query_string) { | |
expires max; | |
} | |
} | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://127.0.0.1:8000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment