开发者

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.


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");


If Apache is already listening to port 80, then the only thing you can do is proxy to your node instance. And yes, apache will create a new thread for each connection.


As others have mentioned, there's not a whole lot you can do here. Apache is currently driving your server and node.js won't like riding shotgun.

I'd recommend checking out things like nodester, no.de, heroku, and so on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜