While you can run a web server using your Mac (Apache), MAMP, ColdFusion or Railo. I prefer to have a self contained Linux box on a virtual machine. I have most of my instances setup with the same configuration as my hosting companies. This allows me to test my code on a platform that closely resembles my production environment.
You can follow this really nice guide by Albertus on Linux Unbound on installing CentOS on Fusion, or watch a quick video by VMware on installing Windows. I normally have my CentOS system running with low resources 512 MB RAM, 20 GB Hard Disk. Windows requires a little more love I boost the memory to 2 GB and have a 80 GB Hard Disk.
I use Eclipse as my IDE, and normally share the workspace folder with my VMs. On CentOS the shared folder is mounted on /mnt/hgfs, where you should see all your shared folders. NOTE: If you want apache to host your files from this folder you need to make sure that SELinux is disabled, otherwise you will not be able to view those pages.
Once you have everything installed and configured, you will need to get your desktop to see the sites hosted on the VM. The easiest way to do this will be to update your host file (located at /etc/host). You will need to know your IP address of the VM machine, if its configured with NAT you should see a private address (ie. 10.0.0.0, 172.16.0.1, 192.168.0.0).
You will still need to do any custom configurations with your Apache or IIS services, but I will leave that for a later post…