How can I forward my localhost to my public IP on a VPS? - linux

I'm running a website on my Linux VPS.
This is what I get on my terminal when the website is running:
Navigate to https://127.0.0.1:7443 in a browser
The problem is that I cannot connect to this on the browser because it's not MY machine's localhost.
Is there a way I can forward this to my VPS's Public IP?
for example, the IP address I use to access the server? To explain better I want to access the website from anywhere from my phone, laptop, etc.

You could possibly use iptables/firewalld such as port recirection

What you are probably searching for is one of these tools:
https://ngrok.com/
http://localtunnel.github.io/www/
These tools will let you access your local page from anywhere in the world.

Related

How can I share a website to a client in which I have built locally using MAMP but is not hosted yet?

How can I show a website to a client in which I have built locally using MAMP but is not hosted yet ?
Bring your Mac to the client, and show them the website.
Send them the html, php, javascript etc. files via email. Tell them to put the files in one directory and to run the main html file.
in your internet router, make a port forwarder, lets say 1333
make this port forward to your computer local ip address/localhost, ex 192.168.0.9/localhost
give your client the ip address and the port, ex 43.13.19.33:1333

If I use http-server with node can other devices on my network access it?

Background
I am building a site using angularjs and want to make sure that its displaying properly on my phone. I'm aware of the Google Chrome emulator but would like to show people it directly on the phone.
Node.JS
I'm using http-server . to run a server at the base of my app. This was the quickest and easiest way of getting a server for local testing.
I have tried going onto the same network via wifi on my phone and then trying to get to localhost:8080 but it just gives me a "this web page is not available" error
Question
My question is, is there a way to get my web app on my phone with http-server . or do I need to set up a proper web-server? I thought maybe it would just be simple to get it on any device attached to the same network.
Since our application(server) and devices(in which you want to access the application) running on same network.
You can access this with the help of IP address.
Let say, your app is running on
192.168.1.1:3000
So you can access it as localhost:3000 on local machine.
And as 192.168.1.1:3000 on devices which is using the same network.
any device can access to server. Use ip in device not use localhost
Use ngrok https://ngrok.com/ , ngrok expose your localhost behind a NAT or firewall to the internet , easy to use , after install just type on command line ;
ngrok 7070
then it gives you a link like ; 3g87g9g.ngrok.com
Use ifconfig utility if you are in linux or use any other tool to get the ip address of your phone (Web server), for example 192.168.1.10 is IP address of the phone.
You can access the web page from any other device in the network by going to 192.168.1.10:8080 in the browser.
Note that 8080 is the port to your server application, you select the port from node.js

Covert home pc to web server steps

I want to convert my home pc to a web server. Already IIS8 has been installed. The sample page has been published on default web site. In windows firewall the port 80 has been opened. I have access to this page through different computers that connect to the same ADSL router. However, when I try to connect to the page from another ISP, I get the error of 'web page not find'. Because I don't have static IP now, I find IP of the server from http://www.whatismyip.com/. I wonder if anybody help my to solve this issue.
One workaround it to use no-ip
http://www.noip.com/
this would give you static IP.
From this point is just normal domain setup.

What address do I use to access my server from the internet?

I have an FTP server hosted on my computer and I want to make it publicly accessible.
I have forwarded the necessary ports for this specific computer on my router. If I type in my local ip, 192.168.x.x, i can access it. But this is only local. How do I access it publicly?
I tried going to my public ip but nothing comes up. I have searched Google for several hours now and have come up with nothing. What am I missing?
Test your server on https://incloak.com/ports/ or http://www.hackerwatch.org/probe/ sites and check that it detects your open FTP server. If not check you operating system firewall.

xampp server (How to get up and running)

I've been developing locally on a little ubuntu netbook with xampp for about 7 months. Two weeks ago I got a computer I'd like to use as a server. I've installed the latest Ubuntu distribution and xampp, moved all my files over, and forwarded port 80. I've also got a domain name from dyndns.com which is being updated by a client which runs in my router (a Netgear WGR6154 v8).
Now, when I try to access my server by typing in the address I got from dyndns.com the browser loads until it timesout. I can access everything locally using localhost as the address so I believe xampp is running, just unable to connect with the internet.
In order to be able to view my files over the internet what should I do next?
Thanks to all in advance...
[I'm starting a bounty for the first person to help me get my files successfully online]
You have a combination of issues here, and that is something of a problem. Each issue is complex in an of itself. Here is what I would recommend to get you going for certain.
First verify that you can surf the web from your server. This will confirm that you have a working ethernet interface.
Step 1 make sure that XAMPP, and your files are viewable from your home network. I assume you are using something like 192.168.1.X for your network and perhaps your server is 192.168.1.10
Go to another computer in your house and type http://192.168.1.10/ and see if you can see your files. If you can then you know that the server is properly configured and XAMPP is working.
Then add an entry to your hosts file to resolve yourdnsrecord.com (or whatever your dyndns record is) to your private ip address. Then when you type yourdnsrecord.com into a browser from that computer you should still get your files. This will rule out your server being improperly configured to listen for that domain name.
Next you need to test to see if there is a firewall problem. To simplify this, first remove your home router from the equation. Instead, place your new server directly onto your internet connection. (assuming you can). This way, you do not need to have NAT or firewalls properly configured. Your dyndns name should map to a public IP and your server should then have that IP and be connected directly to the Internet. If you have your server directly connected, and the command ifconfig from the root prompt returns the same public IP address that your dynamic dns record is point to, then it should work.
It will make your life easier if you have an iphone or some other way to test how your network is seen from the Internet.
If your public IP as shown by ifconfig is different than the IP record in your dyndns account, then your dynamic dns update script is broken. manually set the IP, and see if things work.
It is very possible that this will not work. Some ISPs firewall port 80 preventing their subscribers from hosting servers. Once you have your server directly connected to the internet you can test this (even if your dns is not working) by using the public IP address. As root, type ifconfig from the command prompt to get your public ip address. Then type the command tcpdump -i eth? port 80 from the root prompt. eth? needs to be the same interface that you saw had a public IP address from the ifconfig command. usually this is eth0 but it might be wire0 or something like that.
This command will show you all traffic coming on port 80 to your server.
From an iphone (or whatever second Internet connection you have) browse to the IP address that you got from your ifconfig command. If you see something on your server (and it is directly connected to your ISP) then your ISP is not firewalling you.
If you can get to your server, when it is directly connected to the Internet, either by IP address or by DynDNS address, then your ISP is OK and it is time to debug your firewall.
Two things need to work for your firewall to be configured NAT, where the public address that your router gets from your ISP is converted into your private network and a firewall rule which permits that traffic. If you get this far, then you know your firewall is the problem and then it is just a matter of getting its configuration correct. There are far to many home routers to document here, but you usually can find how-to instructions for your router for this task from the manufacturers website (usually it is part of the manual)
If you follow these instructions exactly you will get your system working. Make comments on the process and I will be happy to modify this to make it clearer.
HTH,
-FT
You should make sure your xampp is not listening to only the localhost.
to do so edit your apache configuration file and check and search for Listen directive
you should be able to know also by analysing the output of netstat -a.
After that make sure your router is forwarding properly, using tcpdump would help.
drop me a comment if you need more help.
Cheers

Resources