Configure Windows 7 with MAMP virtual hosts and Virtual Box

I’m using MAMP Pro for local web development on OSX Lion and needed to test some javascript compatibility with IE so I booted up a virtual machine. It took me a few minutes to figure how to have the DNS resolve to my local development domains that were set up on my main OS.  I couldn’t find this tip immediately online so here it is.

If you want to be able to access your named virtual hosts that you set up on MAMP on a Windows 7 virtual machine make sure you update your hosts file on the Windows VM.

Here’s what works for me.

  1. Install MAMP Pro
  2. Setup local development host in MAMP
  3. Install Virtual Box
  4. Setup Windows 7
  5. Edit the Windows 7 hosts file
    1. Run Notepad as admin in Windows.
    2. Open C:\Windows\System32\drivers\etc\hosts
    3. Add 10.0.2.2 yourdevdomain
      • Add more if you have want.
    4. Save the file.
    5. Instance restart may be required.
If that doesn’t work, check what port Apache is running on and edit the hosts file accordingly.

You may also like

1 Comment

  1. This works great, except in Windows 7 you do need to right-click the hosts.txt file in Windows and allow write/save permission for your user.

Leave a Reply to kylepfeeley Cancel reply

Your email address will not be published. Required fields are marked *