Vagrant can automatically set your port forwarding to your guest os. This makes web development easy.
To follow this article, you should have vagrant installed.
Install Apache on Guest
In the box (guest OS), install Apache web server
box$ sudo apt-get -y install apache2
And test it
box$ wget http://localhost/
An index.html is downloaded to current working directory.
In Vagrantfile, uncomment the line
config.vm.forward_port 80, 8080
The reload the box (reboots guest virtual machine):
$ vagrant reload
Now you can access box (guest OS) web server on (normal, non-virtual) host OS on http://localhost:8080. You should get the familiar “It works” page.
See also
Hashimoto and Bender 2012: Getting Started with Vagrant: Port Forwarding
Karvinen 2008: Install Apache Web Server on Ubuntu
Karvinen 2012: Vagrant on Ubuntu 12.04 – Create and Boot New Virtual Machine in Minutes
Admnistrivia
Tested on xUbuntu 12.04 precise beta 32bit, Linux 3.2.0-18-generic-pae, vagrant 0.9.5-1, virtualbox 4.1.8-dfsg-2.