I have a server (10.0.0.12
) and my laptop (10.0.0.2
) on a local network.
When I run curl http://10.0.0.2:3000
on the server, it works fine. When I run curl http://10.0.0.12:3000
on my laptop, it doesn't work saying site is unavailable.
I am able to ping and ssh into the server from my laptop.
Here is my code to finish the connection:
app.set('port', (3000));
app.listen(app.get('port'), function(){
console.log("Node app running on localhost:" + app.get('port'));
}
I've tried passing in an ip address to the listen()
function, but made no difference. I tried passing in 10.0.0.12
(the ip address of the server), 127.0.0.1
, and 0.0.0.0
all with the same result.
How can I host my node app on a local network and have everyone who is on the local network be able to access it through the browser?
EDIT: I'm running on CentOS 7.
EDIT2: When I run netstat -lnt
, it says this:
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN