-
-
Save houming818/e7ad667994c9cf9c7df86b091c844c70 to your computer and use it in GitHub Desktop.
Nginx Reverse Proxy for WebSocket
This file contains 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
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