andrux andrux -4 years ago 90
Node.js Question

How can I access my nodejs web server from my local computer using the server domain name?

I installed nodejs and created a sample app. When I run

npm start
I get a message saying that I can open my web browser to http://localhost:3000 to see the app in action, but this installation is on a web server - not my local computer, so, instead of localhost:3000 I want to get there using something like

I can't find the answer, it's very likely I just don't know how to search for it... any ideas?

I'm following the tutorial here:

Answer Source

I think I only needed to get away from this for a while. I got it working using ssh local forwarding.

I already used an ssh config file to log in to my server without having to remember the password, so I just added this line to my config file:

LocalForward localhost:3000

where is my server IP address.

Then, I connected to my server via ssh:

ssh -f -N mysite

Once connected, I open up the browser and go to localhost:3000 and there it is now.

I used my ssh config file, but it should also work without it.

ssh -f -N -R 3000:localhost:3000

I found this command that eventually led me to solve my problem in this link:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download