I have a simple node.js app that listens to two ports: on 8001 it sets up a simple webserver by doing
var express = require('express');
var gHttpApp = express();
gHttpApp.use(express.static('public'));
gHttpApp.listen(8080, function () {
console.log('HTTP Server listening on *:8001');
});
Then, on 8002 it sets up socket.io
var io = require('socket.io')();
gSocket = io.listen(8002);
In my index.html inside the /public folder, I request the socket.io client js by doing:
<script src="http://localhost:8000/socket.io/socket.io.js"></script>
while the other js file are requested with relative path inside /public.
This setup worked while developing locally and seemed logical, but I have no idea how to deploy it on my private server which runs Ubuntu and nginx, since I can not reverse proxy the same location into 2 ports...