How to spawn multiple instances of node.js on one machine to listen for different subdomains? -
this question has answer here:
for subdomain
a.abc.com b.abc.com c.abc.com
i want run same duplicate of node.js script them. have 1 machine unfortunately. can suggest how may overcome this?
if have 3 "handlers", ie function (req, res)
signature, can following on single server:
http.createserver(function (req, res) { switch (url.parse(req.url).hostname) { case 'a.abc.com': handlera(req, res) break case 'b.abc.com': handlerb(req, res) break case 'c.abc.com': handlerc(req, res) break default: res.statuscode = 404 res.end() break } })
you don't need reverse proxy unless need every handler on own process, ie if have lot of load
Comments
Post a Comment