Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache: how can I access my webpage from a computer outside my network?

I want to access my webpage from a computer outside the network. Our network has IPs like 192.168.0.1-192.168.0.255. The network is connected to Internet through a local gateway 192.168.0.1 and gets to DNS server 193.xxx.xxx.xxx.

Let's say my computer has the IP 192.168.0.50. How can I my website from my server (Apache) from a computer which is not from our network (let's say 254.231.52.xxx)?

Thank you!

like image 711
tzortzik Avatar asked Feb 26 '12 15:02

tzortzik


People also ask

How can I access my website from outside my local network?

Use a VPN. If you connect to your local area network by using a virtual private network (VPN), you don't have to open your PC to the public internet. Instead, when you connect to the VPN, your RD client acts like it's part of the same network and be able to access your PC.

How do I make my home server accessible over the Internet?

in your router, configure the firewall to allow the specific port your server uses (say port 4321). in your router, configure a port-forward for the port 4321 to the internal IP address of your actual server, also to port 4321. on your server, ensure your firewall allows connections to port 4321.


1 Answers

Short answer:

The solution to this would be to find out the 'external IP' of your router and enable a port forwarding for port 80 and 443 to your local IP.

Long answer:

The Internet is divided into 'public' and 'private' IP spaces. Private IPs are usually not directly accessible from a 'public' IP. The IPs from the 192.168.0.1-255 are from one of these private subnets.

Your router (at home) usually has multiple IPs. One or more from your local private network (192.168.0.X) and one from your local ISP (I guess something like 193.xxx.xxx.xxx because your DNS is in that network) which is from the 'public' space.

To connect to your computer with the private IP from a public IP like the mentioned 254.231.52.xxx you would have to connect to the public IP of your router (the 193... one). You would also have to enable a mechanism that is called 'port forwarding'. This effectivley takes all internet traffic arriving at the public IP of your router on the forwarded ports and transfers it to the private IP you configured the forwarding to. E.g. 254.231.52.. -> 193...:80 -> 192.168...:80 Usually home routers have a configuration page where you can do this. The required ports you would probably use are 80 (http) and 443 (https).

Another possibility is using so called http-proxies which are also usually supported as a configuration option one home routers. You should refer to the manual of your router for configuration instructions of this.

like image 125
Bernd May Avatar answered Oct 12 '22 13:10

Bernd May