Skip to content

Instantly share code, notes, and snippets.

@mitio
Created March 30, 2015 10:56
Show Gist options
  • Save mitio/e429281046f89a51ccac to your computer and use it in GitHub Desktop.
Save mitio/e429281046f89a51ccac to your computer and use it in GitHub Desktop.
Nginx Config for HTTPS (forced) site (example.com)
# Force HTTPS
server {
listen 80 default;
server_name example.com *.example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl;
server_name example.com *.example.com;
root /somewhere;
# SSL setup
ssl on;
ssl_certificate /etc/certificates/example.com/example.com-bundle.crt;
ssl_certificate_key /etc/certificates/example.com/example.com.key;
# from https://github.com/ioerror/duraconf/blob/master/configs/nginx/nginx.conf
# Only strong ciphers in PFS mode
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols TLSv1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment