Last active
August 29, 2015 14:09
-
-
Save kylefinley/0161f9bdbf23350529b6 to your computer and use it in GitHub Desktop.
Derby NGiNX config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the IP(s) on which your node server is running. I chose port 4000. | |
upstream exampleprod { | |
ip_hash; | |
server 127.0.0.1:4000 max_fails=2 fail_timeout=10s; | |
# server 127.0.0.1:4001 max_fails=2 fail_timeout=10s; | |
keepalive 8; | |
} | |
# Redirect HTTP traffic to HTTPS | |
server { | |
listen 80; | |
server_name example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
# the nginx server instance | |
server { | |
server_name example.com; | |
access_log /var/log/nginx/example.com.log; | |
# Adding default_server will cause Nginx to send this ssl cert as a default | |
# for browsers that don't support SNI SSL | |
listen 443 deferred ssl spdy; | |
ssl_certificate /etc/nginx/ssl/example.com.crt; | |
ssl_certificate_key /etc/nginx/ssl/example.com.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:EECDH+RC4:RSA+RC4:!MD5; | |
ssl_prefer_server_ciphers on; | |
# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://exampleprod; | |
proxy_redirect off; | |
# Websockets | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
location /-/images { | |
proxy_cache one; | |
proxy_cache_valid 200 302 1w; | |
proxy_cache_valid 404 1m; | |
proxy_pass http://exampleprod; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment