I have a domain name: www.domain. I setup a DNS type A record with my router's public IP address.
Now if I go to www.domain, 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. .png
The IP address should be my puter's IP I got from entering ifconfig
into the terminal. So I enter my puter's IP address and 3000 for the port.
Now if I go to my www.domain, I still get the my router's homepage.
Does anyone have an idea what port I should be entering?
I have a domain name: www.domain.. I setup a DNS type A record with my router's public IP address.
Now if I go to www.domain., 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. https://i.sstatic/UL682.png
The IP address should be my puter's IP I got from entering ifconfig
into the terminal. So I enter my puter's IP address and 3000 for the port.
Now if I go to my www.domain., I still get the my router's homepage.
Does anyone have an idea what port I should be entering?
Share Improve this question edited Jun 7, 2016 at 17:37 Aᴍɪʀ 7,8033 gold badges39 silver badges54 bronze badges asked Dec 31, 2015 at 9:28 BobbyBearBobbyBear 611 gold badge1 silver badge3 bronze badges 2- You are going to want to set your localhost to a domain name. I am sure you can do this multiple ways but you can find a lot of tutorials to change localhost to example or what ever – wuno Commented Dec 31, 2015 at 9:32
- @wuno Currently I'm using express.js to connect to the node.js server with my app. Not sure how familiar you might be with express, but the code that connects my app to node.js is: app.listen(3000); Do you mean to modify my app code for the domain to listen to myapp node.js server? Or would this be modifying some ubuntu localhost files? – BobbyBear Commented Jan 2, 2016 at 2:09
3 Answers
Reset to default 8Do you actually want to run the production site www.[yourdomain].
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 pletely 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.
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
Trouble Shoot TESTS: Two things e to mind. Your IP address(external vs internal) and Port Forwarding. Thing to remember: 1.You can only port forward to one device. 2.When you Port Forward you will need to use your Local(internal) IP address of the device you want to Port Forward to.
Tests:
1.Try from a different puter (that is in your local network) to access your site. If you can see it, your routers home page is set to the same port. You will need to change that. Look it up in support from the pany who made the router web page.
2.Try to access from out side you network. (cellphone with wifi off) If you see your routers home page your router has been set to enable remote access to the router. You will need to turn that off.
3.In CMD window(Windows 10 type cmd in Cortana search box on the bottom left and hit enter) type "ipconfig" hit enter. Default IP is your router and "IPv4 Address" is the IP of device you are on right now. when you Port Forward us your IPv4 Address.