Hosting a Website With Virtualbox
Virtualbox makes it easy to host a website on your virtual machine. This tutorial will discuss the basic setup. It assumes you have already installed the usual Linux, Apache, PHP and mySQL. If you need help with that, please check out the page here.
Hosting at home can be easily done if you set the DNS to point to your IP address assigned by your Internet Service Provider.
After you have set the DNS, you need to run two wireless connections from your host pc. By doing this, your router will assign two local network IPs; one for each wireless connection. Note that you will want your host machine to use both wireless connections.
Now, you need to alter the settings with your Virtualbox guest machine so that it connects with one of the wireless adapters. In this case, you will use the Bridged Adapter. By default, the network adapter is set to ‘NAT’, which means it would use the same ip as your host pc. The setup is shown below.
After you have made the changes, you can boot your virtual machine. Meanwhile, you can allow port forwarding for port 80 on your router to be set to the IP address that is used by the virtual machine. You router will show its connections and you should easily find the ip for your wireless(or wired) connection. When you do find it, make sure to allow port 80 to be forwarded for that ip address.
After you have set the port forwarding, you should easily be able to access the website with http://<myipaddress>.com or http://example.com.
Using this method is an easy and quick method to host private web applications on your local virtual machine.