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.
solve my problem, and @mojaray2k video implement was really clear.
we dont need to rebuild or install another mod on WHM and mod_rewrite concept, I can't take the risk if my Cpanel going error.
FYI if you want to express require module together with http module, simply using this code
/*****************************/
var app = express();
var http = require('http');
/* pur some apt.set here /
/ pur some apt.use or express static configurations here /
/ pur some apt.get here */
app.server = http.createServer(app);
app.server.listen(80, '111.111.111.111'); // change 111.111.111.111 with your reserve IP