Hosting multiple Express (node.js) apps on port 80

In the last days, i was trying to find a solution hosting multiple Express apps on my vServer the same Server.

Starting with Apache and mod_proxy, i ended up with a plain node solution, which i really like.

Let’s take a quick look on some different approaches out there:


Using apache on port 80 as a proxy

ProxyPass /nodeurls/ http://localhost:9000/
ProxyPassReverse /nodeurls/ http://localhost:9000/

via stackoverflow

— no websockets
++ probably the easiest way to integrate with your running AMPP-stack


Using a node.js app on port 80 as a Wrapper for other node apps.

  .use(express.vhost('', require('/path/to/hostname1').app)
  .use(express.vhost('', require('/path/to/hostname2').app)

via stackoverflow

++ you can use websockets on port 80
— apps crash/restart/stop globally
–what about your apache or the like?


Using node.js with node-http-proxy on port 80

var http = require('http')
, httpProxy = require('http-proxy');

  hostnameOnly: true,
  router: {
    '': '',
    '' : ''

++ proxy websockets to any port
— you might need to move your old web server to another port

The really cool thing about using node-http-proxy is its capability of proxying websockets.
So you can have your apps running independtly on different ports while serving everything to the user over port 80 and use stuff like

Since i’m new to node.js and miles away from beeing a admin, any feedback is highly appreciated :)