I have to put nodejs in port 80, but apache is already using it. How can I put both (nodejs and apache) on the same port 80? I need it because in my university all the ports
I found a cool gist Run apache and nodejs on port 80. did not try it yet but will do of course
Step 1
Get a VPS that offers 2 or more IP addresses.
Step 2
From the WHM cPanel, find the menu item
Service Configuration, selectApache Configurationand then click onReserved IPs Editor.Step 3
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.Step 4
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.111with the IP address you previously reserved from the WHM cPanel.Step 5
Stop wasting your time and never listen to those telling you to use
mod_rewriteto proxy Node.js again.
Update:
We can solve a problem in many different ways and IMHO, we should at least know each possible way