Skip to content

Instantly share code, notes, and snippets.

@wushan
Created May 3, 2017 08:20
Show Gist options
  • Save wushan/28a85c74052de11a855afe5b2f3c1138 to your computer and use it in GitHub Desktop.
Save wushan/28a85c74052de11a855afe5b2f3c1138 to your computer and use it in GitHub Desktop.
ssl
# HTTP - redirect all requests to HTTPS:
server {
listen 80;
server_name notable.wushan.io;
return 301 https://$host$request_uri;
}
# HTTPS - proxy requests on to local Node.js app:
server {
listen 443;
server_name notable.wushan.io;
ssl on;
# Use certificate and key provided by Let's Encrypt:
ssl_certificate /etc/letsencrypt/live/notable.wushan.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/notable.wushan.io/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
# Pass requests for / to localhost:8080:
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:9487/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment