Skip to content

Instantly share code, notes, and snippets.

@xx7y7xx
Last active August 10, 2017 15:29
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 xx7y7xx/ca57fbc0ff7ba07ee45b72e50b47d372 to your computer and use it in GitHub Desktop.
Save xx7y7xx/ca57fbc0ff7ba07ee45b72e50b47d372 to your computer and use it in GitHub Desktop.
nginx socket.io proxy
# MFC project START
# web page and static files
location ^~ /m/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://10.3.14.1:3000/m/;
proxy_redirect http:// https://;
}
# socket.io(websocket)
# http://nginx.org/en/docs/http/websocket.html
# need nginx@1.3.13 to support Upgrade header
location ^~ /socket.io/ {
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://10.3.14.1:3000/socket.io/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# MFC project END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment