Jamshaid
Jamshaid

Reputation: 410

Unable to access localhost:3000 from other machine

I'm having a node.js application running on localhost:3000 and able to access it through my browser. I'm having the following configuration in my server.js file.
here port is 3000

app.listen(port, '0.0.0.0', function onStart(err) {
if (err) {
    console.log(err);
}
console.info('==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.', port);
});

When I try to access my server using my laptop's IP by checking it through what's my ip on google e.g. ip is http://58.27.123.12:3000, it doesn't take me to the requested page. I'm running the application on Ubuntu 19.10. I'm also able to ping my ip through other systems and it responds successfully. What I might be doing wrong? Thanks

Upvotes: 0

Views: 1953

Answers (1)

Nikas
Nikas

Reputation: 247

if you want people to access on LAN give them your localIP with port number or if you want to provide access via internet check below links:-

https://localhost.run/

https://localtunnel.github.io/www/

ssh -R 80:localhost:3000 ssh.localhost.run 

using this command solved the issue after installing localtunnel

Upvotes: 1

Related Questions