Created
September 9, 2011 18:34
-
-
Save jessejlt/1206970 to your computer and use it in GitHub Desktop.
nginx & socket.io
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
var socket = io.connect('http://mydomain.com:4000'); |
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
<!-- include socket.io script, which isn't on disk, but nginx will redirect this request to node.js, and socket.io will | |
then serve the requested script --> | |
<script src="/socket.io/socket.io.js"></script> |
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
server { | |
listen 80; | |
server_name mydomain.com; | |
location ~ /socket.io/socket.io.js { | |
proxy_pass http://127.0.0.1:4000; # replace 4000 with the port that node.js is on | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment