Skip to content

Instantly share code, notes, and snippets.

@ceremcem
Last active September 5, 2015 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceremcem/5176ac7215b5b669f601 to your computer and use it in GitHub Desktop.
Save ceremcem/5176ac7215b5b669f601 to your computer and use it in GitHub Desktop.
Nginx proxy node.js socket.io app
# this is the necessary configurations for
# proxying a socket.io Node.js application with Nginx
#
# check for updates at: https://gist.github.com/ceremcem/5176ac7215b5b669f601
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
# usage example
# #############
# (save this file as /etc/nginx/websocket_proxy_params)
#
# this block creates a proxy for http://10.0.10.176:4000 at http(s)://server-addr/hmi
# location ~ /hmi {
# rewrite ^([^.]*[^/])$ $1/ permanent;
# rewrite /hmi/(.*) /$1 break;
# proxy_pass http://10.0.10.176:4000;
# include websocket_proxy_params;
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment