Wokers
Wokers

Reputation: 117

how to connect express app in VM from internet?

I am running an express app in node.js on Azure Linux VM, and I want to connect this website from my personal computer.

const express = require('express');
const app = express();

app.listen(3000, () => 
{
    console.log("Server is running..");
})

And for ex. in my computer, I can just run localhost:3000 but on VM, I cant reach.

The public ip adress of VM is 40.XXX.XX.252 and I try to connect on my browser like this : http://40.XXX.XX.252:3000 but it doesn't work either..

I know it is really common question but i tried everything that is suggested and I couldnt fix.

ps: I tried to run this app on my computer and again, I could connect through localhost:3000 but not from another computer with my computer's public ip.

Upvotes: 1

Views: 290

Answers (1)

Jason Pan
Jason Pan

Reputation: 21916

Problem causes:

It must be that port 3000 is not open. You can open port 3000 through commands to set it. (The settings in the firewall also need to be checked)

But I personally think this is not safe.

I recommend using an intranet penetration tool, which is the safest way to access through the generated link, because sometimes the public ip assigned by the operator is not fixed. Here I recommend using ngrok linux version.

You also can refer to my answer in another post.

enter image description here

sending http request from azure web app to my machine

Upvotes: 1

Related Questions