Skip to content

Instantly share code, notes, and snippets.

@jessejlt
Created September 9, 2011 18:34
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 jessejlt/1206970 to your computer and use it in GitHub Desktop.
Save jessejlt/1206970 to your computer and use it in GitHub Desktop.
nginx & socket.io
var socket = io.connect('http://mydomain.com:4000');
<!-- 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>
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