Node js server not responding outside localhost centos
Posted
by
David Martinez
on Server Fault
See other posts from Server Fault
or by David Martinez
Published on 2014-06-04T14:46:06Z
Indexed on
2014/06/04
15:28 UTC
Read the original article
Hit count: 286
I'm running a basic express server from CentOS but for some reason it is not responding outside of localhost, I have tried everything I have found on google but nothing works so far.
This is my express server:
app.listen(3000,"0.0.0.0");
If I do curl http://localhost:3000/
in the server it works fine.
If I curl to the ip of the server it doesn't work.
I already changed my iptables
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3000
There is currently a apache server running on port 80 with no problems.
I also tried setting a VirtualHost on apache but it didn't work either:
<VirtualHost *:80>
ServerName SubDOmain.MyDomain.com
ProxyRequests off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost on
</VirtualHost>
There is another virtual host working fine that redirects to another DocumentRoot.
I'm running Node on root for testing purpose, but the node application owner is another user. All folders have 705 and files 664
Edit: I stopped apache and run my node app on port 80 and it working fine, I could access node app from my ip and domain.
© Server Fault or respective owner