Get a VPS that offers 2 or more IP addresses.
From the WHM cPanel, find the menu item Service Configuration
, select Apache Configuration
and then click on Reserved IPs Editor
.
Tick the IP address you DON'T WANT Apache to listen to, and write it down so you can use it in the next step. Click Save
.
Install Node.js, and create a server like this:
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello, world!');
});
server.listen(80, '111.111.111.111');
Replacing 111.111.111.111
with the IP address you previously reserved from the WHM cPanel.
Stop wasting your time and never listen to those telling you to use mod_rewrite
to proxy Node.js again.
This is a terrible idea. How come anyone who ever says "The right way" invariable proceeds to tell you the wrong way to do something.? Is it perhaps because the type of person who thinks there is only one right way is ipso facto wrong?
Anyway you now have a service (a node server) running as ROOT (since port 80 is privileged and you have done nothing to separate out the privileges) (unless you are running this on a windows server in which case you are already wrong.) You are also wasting an IP for no good reason, though that is a trivial point. Put it behind nginx if you must, or apache, or haproxy for all I care. Don't run your server with root permissions. Jeesh.
Also, if you are making anything you are ever going to use, one day you will be happy to have a real server with abilities like mod_rewrite at your disposal.