Skip to content

Instantly share code, notes, and snippets.

@korczis
Created November 14, 2015 05:24
Show Gist options
  • Save korczis/f8680aa880495a159a35 to your computer and use it in GitHub Desktop.
Save korczis/f8680aa880495a159a35 to your computer and use it in GitHub Desktop.
# the IP(s) on which your node server is running. I chose port 8080.
upstream app_mapoffacts {
server 127.0.0.1:8080 weight=1 fail_timeout=60s;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name mapoffacts.com;
access_log /var/log/nginx/mapoffacts.com.log;
# pass the request to the node.js server with te 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;
# socket.io stuff
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Pass to upstream
proxy_pass http://app_mapoffacts/;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment