Skip to content

Instantly share code, notes, and snippets.

@hpcorona
Last active August 29, 2015 14:16
Show Gist options
  • Save hpcorona/1a1291e8783653131629 to your computer and use it in GitHub Desktop.
Save hpcorona/1a1291e8783653131629 to your computer and use it in GitHub Desktop.
Nginx Configuration for HTTPS for Play!
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443;
server_name www.server.com;
# error_log /etc/nginx/sites-enabled/error.log debug;
ssl on;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/certificate.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparam.pem;
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://localhost:9000;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /web/ {
root /var/www/html;
index index.html;
expires 7d;
if ($request_uri ~* \.nocache\.(html|js|gif)$) {
add_header Last-Modified "{now} GMT";
add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0";
add_header Cache-Control "post-check=0, pre-check=0";
add_header Pragma no-cache;
expires -1d;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment