What do I need to run a node.js script on my serve

2019-04-26 02:02发布

问题:

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

回答1:

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.



回答2:

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