Reputation: 357
I have a node js server set up on AWS using Linux instance(Ubuntu 14.04) I have started the server using the command npm start
How do I access the localhost:3000. And when I do it locally I am able to access all the webpages by going to the browser. How can i access it when the server is on cloud?
Upvotes: 1
Views: 2249
Reputation: 481
Make sure your application listens on an external interface. This means that instead of using 127.0.0.1 as in .listen() pass "0.0.0.0" - this will make your server available on all the interfaces on the server.
Upvotes: 0
Reputation: 111336
The localhost
host name is resolved to IP address 127.0.0.1 (or IPv6 equivalent) which is routed to the loopback interface so that you cannot reach any other host than your own with that. That's why it's called localhost
in the first place.
To reach your host from the outside you need to know its external IP address or a domain name that resolves to its external address. You should be able to see your external IP in the dashboard. If you can't then see this answer.
Upvotes: 1