Simple MAMP/MAMP Pro VirtualHosts in Parallels / Windows XP

(This tip should also work similarly with Vista, Windows 7, etc.).

After browsing around a bunch of different forums, the MAMP site, and Parallels documentation, I was still flummoxed by Parallels' weird Shared Host networking behavior, which seemingly didn't allow me to access virtualhosts I set up with MAMP for developing sites locally.

After much experimentation, I found that the simplest way to be able to type in 'local.example.com' (or 'dev.example.com', if that's your style) in Internet Explorer on Windows, and get a virtual host running via MAMP on my Mac, is to do the following:

  1. In Parallels' options for your virtual machine, go to Hardware, then Network 1, and choose 'Default Adapter' for 'Type'.
  2. Restart Windows in Parallels.
  3. Get your Mac's IP address (for your WiFi adapter or Ethernet; whatever's the primary interface).
  4. Open your Windows Hosts file and add your virtual hosts:
    1. Start > Run... and enter "c:\windows\system32\drivers\etc\hosts" (use Notepad to open).
    2. Add a line like the following to the file and save: "[MAC_IP_ADDRESS]   local.example.com"

You should now be able to access whatever site you have defined at local.example.com in MAMP via Windows Internet Explorer.

Update: It looks like this will work if you choose the 'Shared Network' type as well; go figure. Parallels' networking support is a bit more dodgy than VMWare Fusion (which I'd been using on my old MacBook Pro for quite a while without a problem... when I bought a MacBook Air, I thought I'd try out Parallels again).

Comments

Hey Jeff. I had this working while ago. Since upgrading to a boot SSD something has broken... I used ifconfig (vnic0) as my IP address, which worked before the upgrade. Now all my VMs (4 machines covering IE 6 through 9) are kicking a "Permission denied for / on this server". Any ideas? Thanks man.

Joel