7

I have a standard Apache server. Do I need anything special to run a node.js script (http://socket.io/) on the serverside?

2 Answers 2

10

Node.js provides its own HTTP server, thus making Apache unnecessary.

If you wish to run Apache and Node.js on the same server, either set node to listen to port 80 and forward unhandled requests to Apache, or vice versa

In both instances, Node/Apache will listen to the publicly open port 80, and forward to Apache/Node listening on some non-public port.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for that information. A question, please. It seems to me that it makes more sense from a performance perspective to use Node/Apache instead of Apache/Node. (assuming that 50% of requests go to Node.js, and 50% to Apache.) Is that true?
In my opinion, yes, that is true. Node likely has a much shorter 'path' than Apache for offloading requests as early as possible. Always worth some performance testing, though.
1

You will need shell access to start the node.js server. So it most likely won't work on shared hosting.

2 Comments

I have a virtual private server with shell access.
Then you can simply install node.js. How you do it depends on your distribution (unless you want to compile from source) and if you have questions about it, better ask them on serverfault.com

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.