Port forwarding router to listen on node.js server on home computer

11,897

Solution 1

Do you actually want to run the production site www.[yourdomain].com on your local machine? Or is that just an example and are you only interested in having a development/test environment available publicly?

If the second, then you could also try a completely different solution: use port forwarding software like ngrok. You can install and run the ngrok client on your local machine and it will set up a tunnel for you, to make your local machine visible on the internet.

You will receive a URL like http://6cdd8912.ngrok.io which tunnels to your local machine.

Every time you start ngrok, a new tunnel with a new hostname is created, so this is not a good solution for production websites.

Solution 2

In router, you configure Router's homepage port to other port (ex. 8080).

In port forwarding : configure :

Local Port and IP : Port start: 80, Port end: 80.

Remote Port and IP : Chose : IP adrress : Local Ip's address of node.js Server

Port Start: 3000 Port End : 3000

Share:
11,897
Admin
Author by

Admin

Updated on July 14, 2022

Comments

  • Admin
    Admin over 1 year

    I have a domain name: www.domain.com. I setup a DNS type A record with my router's public IP address.

    Now if I go to www.domain.com, I'd be redirected to my router's homepage. What I need to do is to forward the port to my node.js server application that is running at localhost:3000.

    Picture for reference. http://i.imgur.com/WyxBKmY.png

    The IP address should be my computer's IP I got from entering ifconfig into the terminal. So I enter my computer's IP address and 3000 for the port.

    Now if I go to my www.domain.com, I still get the my router's homepage.

    Does anyone have an idea what port I should be entering?

  • Admin
    Admin almost 8 years
    The first is what im interested in.