How do I browse to virtual websites running on the same network ?

April 4, 2016 319 views
Networking Apache Firewall DNS LAMP Stack

I am trying to find out if it is possible to to use my browser to directly access virtual websites which are running on my network.
I have a business grade broadband service delivered by ADSL, and my ISP has allocated me a fixed IP address.
I have a couple of web sites running on Ubuntu Server 14.04 with Apache 2.4.7, although I don't think the OS or webserver version is relevant to this problem.
The "A" records have been set up correctly and at the moment the web sites work fine when viewed from the "outside world", but I am unable to view them from a browser on a machine on the same network. The "solution" I use at the moment is to set up my mobile phone as a wireless hotsopt, and then connect my laptop to it. I can then use the laptop browser to view the sites by sending http requests via the 3g phone network to the WAN side of my router.
Is there some way that I can get my browser (any browser) to send some kind of request to the server which will fool it in to serving up the pages from these virtual sites ?
At the moment, if I try to browse to one of these sites, the external DNS appears to return the correct external IP address and I am then presented with the admin page for the router.
Everything else that I try simply returns the default server page from /var/www/html

1 Answer

Without going intro the intricacies of your network configuration the first thing I would recommend is that you set up a host file entry on the machine you want to use to browse the site from within the network.

On windows, the hosts file is located in C:\Windows\system32\drivers\etc\hosts
On Linux and OSX it can be found in /etc/hosts

If you add an entry there (on the computer you are browsing from) that maps the domain name to the LAN IP address (the local address, not the public one) you should be able to browse the site.

Have another answer? Share your knowledge.