Skip to content

Instantly share code, notes, and snippets.

@simonsmiley
Created October 3, 2016 13:24
Show Gist options
  • Save simonsmiley/5fb92bc0086ed06e1e8b74547c02d421 to your computer and use it in GitHub Desktop.
Save simonsmiley/5fb92bc0086ed06e1e8b74547c02d421 to your computer and use it in GitHub Desktop.
server {
listen 0.0.0.0:80;
server_name koel.example.com
server_tokens off;
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /srv/http/letsencrypt;
}
location / {
return 301 https://$server_name$request_uri;
}
}
## HTTPS host
server {
listen 443;
server_name koel.example.com;
server_tokens off;
client_max_body_size 50m;
## Strong SSL Security
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
ssl on;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
ssl_trusted_certificate chain.pem;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
## [WARNING] The following header states that the browser should only communicate
## with your server over a secure connection for the next 24 months.
add_header Strict-Transport-Security max-age=63072000;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
location / {
proxy_pass http://localhost:10509;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://localhost:10509 $scheme://koel.example.com;
add_header Front-End-Https on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment