2
votes

I'm facing an issue.

I have created vm instance on google compute engine. vm instance external ip is: 104.198.225.177. accessed ssh and installed nodejs. now I want to run 2 nodejs script one in port 8000 another in port 9000.

if want to run and access 2 nodejs url like this: http://104.198.225.177:8000 and http://104.198.225.177:9000

I have created script but when I start and try to access in browser using vm instance external ip, like : http://104.198.225.177:3000/ but its not working. I tried in ssh cur like : curl localhost:3000/ and its working but using external ip its not working.

when I add ip address while starting nodejs like this: app.listen(9000,"104.198.225.177"); I'm getting this error: listen EADDRNOTAVAIL 104.198.225.177:9000 at Object.exports._errnoException

any help appreciated.

1

1 Answers

6
votes

Ensure that you've allowed traffic from external sources to reach certain ports of your GCE instances in Networking Firewalls section.

Solved: Also ensure that your application is bound to 0.0.0.0/all interfaces and addresses, not just VMs public IP address.