Skip to content

Instantly share code, notes, and snippets.

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 giovannyreyeso/df3765ff005e74c636c96afd1b7c42a8 to your computer and use it in GitHub Desktop.
Save giovannyreyeso/df3765ff005e74c636c96afd1b7c42a8 to your computer and use it in GitHub Desktop.
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
location /socket.io/ {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /socket.io/socket.io.js {
proxy_pass http://websocket;
}
location /sample.html {
root /usr/share/nginx/html/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment