Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting node.js for a specific domain only on a VPS

I have a VPS where I have hosted a few sites. All based on LAMP stack, so it was no big deal. They provide WHM/cpanel for managing different sites. I decided to try node.js, bought a separate domain for it, and I need some clue how to point that domain to the node.js application.

So here are the questions:

1) What is the best way to host node.js application on a specific domain without hampering the other sites? How will I configure the domain? Yes, I'd like to use default http port (80) for node.

2) As Apache is already listening to the 80 port, is it a good idea to use Apache mod_proxy for the purpose? I mean if I want to use websocket, will apache still use separate threads for maintaining connection to node?

PS. I have already seen this question, but the answers don't seem to be convincing.


Edit:

I forgot to mention, I have an unused dedicated IP for that VPS which I can use for node.js.

like image 650
Mehdi Avatar asked Oct 03 '11 19:10

Mehdi


1 Answers

Follow these steps

  1. Goto "WHM >> Service Configuration >> Apache Configuration >> Reserved IPs Editor" and then 'Reserved' the IP that you want to use for node.js. This will release the IP from apache.

  2. Create a new DNS entry with a A entry like - example.com A YOUR_IP_ADDRESS

  3. Tell the node.js server to listen to your IP using server.listen(80, "YOUR_IP_ADDRESS");

like image 197
Rifat Avatar answered Sep 24 '22 16:09

Rifat