Using named hosts from within VirtualBox
When I develop web apps, I give them local aliases like scribophile.dev. I do this by using the NameVirtualHosts directive in Apache2. That way, I can type (for example) http://scribophile.dev in my browser instead of http://localhost:8080 or something like that.
My host machine runs Ubuntu, so I need a VirtualBox guest running Windows to test web apps in IE. To be able to access http://scribophile.dev from the VirtualBox guest, edit c:\windows\system32\drivers\etc\hosts and add the line: 10.0.2.2 localhost yoursite.dev www.yoursite.dev othersite.dev
Remember to add both yoursite.dev and www.yoursite.dev (and as many other subdomains as you might use), otherwise VirtualBox gets confused.
And that should be it! Assuming your NameVirtualHost settings are correct on your host, you should now be able to access your host by typing (for example) http://scribophile.dev into the guest’s IE address bar. No need to set your networking to Bridged.
Because VirtualBox uses your host as a “router” when connecting to the internet, it assigns your host the IP of 10.0.2.2 by default.