Node.js apache virtual host configuration

apache-2.2node.js

My server's name goes like this: servername.myhostingcompany.com.
When I run the sample node.js application, I can see the hello world message when I go to servername.myhostingcompany.com:8124.

I don't want to use the server's host name though.

How can I make node.js run and listen on a different virtual host (like for example chat.mydomain.com:8124 or www.mydomain.com:8124)?
I assume this can be set up in the apache configuration?

Best Answer

If apache server isn't listening on port 8124 then I think it doesn't have to do anything with your apache configuration. From node.js docs:

server.listen(port, [hostname], [callback])

Begin accepting connections on the specified port and hostname. If the hostname is omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY).

Your sample node.js application have hostname parameter probably omitted, so it's now serving every available hostname under port 8124.