Install forever and bouncy first .
Then write a startup script. In this script, add a rule to the iptables firewall utility to tell it to forward traffic to port 80 to port 8000 (or anything else you choose). In my example, 8000 is where I run bouncy
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000
Using eternity, give the script command to run bouncy on port 8000
forever start
The .json routes will be something like
{ "subdomain1.domain.com" : 5000, "subdomain2.domain.com" : 5001, "subdomain3.domain.com" : 5002 }
NodeJS1, application2, and application3 applications run on ports 5000, 5001, and 5002, respectively.
script In my case, I can find it here , and you may have to change it a bit in your environment.
I also wrote about this in more detail, and you can find it here .
Kevin Le - Khnle Mar 01 '15 at 8:15 2015-03-01 08:15
source share