Skip to content

Instantly share code, notes, and snippets.

@alexlabarces
Created February 22, 2014 19:11
Show Gist options
  • Save alexlabarces/9160303 to your computer and use it in GitHub Desktop.
Save alexlabarces/9160303 to your computer and use it in GitHub Desktop.
NGINX Proxy SSL Configuration for Deployd
# ==================================================
#
# NGINX Proxy SSL Configuration for Deployd
#
# Notes: Be sure to change the following
# 1. example.com
# 2. /path/to/ssl/cert/server.crt
# 3. /path/to/ssl/key/server.key
# 4. Default Deployd port is used (2403)
#
# ==================================================
server {
listen 443;
server_name example.com;
# SSL Configuration
# ==================================================
ssl on;
ssl_certificate /path/to/ssl/cert/server.crt;
ssl_certificate_key /path/to/ssl/key/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
# Tell Node that the connection is secure even if it's just HTTP
# ==================================================
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_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_read_timeout 5m;
proxy_connect_timeout 5m;
# Needed to securely proxy Websocket requests
# ==================================================
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
# Handle API EndPoints
# ==================================================
location / {
# Define Custom logs (track all HTTP requests)
# ==================================================
log_format requests '$remote_addr - [$time_local] "$request" $status "$request_body"';
access_log /var/log/nginx/access.log;
access_log /var/log/nginx/requests.log requests;
# Access Control Header is needed in order to allow requests from HTTP to HTTPS and viceversa
# ==================================================
add_header Access-Control-Allow-Origin *;
proxy_pass http://localhost:2403;
proxy_redirect off;
}
# Handle the Dashboard
# ==================================================
location ~ ^/(dashboard) {
access_log /var/log/nginx/dashboard_access.log;
add_header Access-Control-Allow-Origin *;
proxy_pass http://localhost:2403;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment