How do I access my apache web-server (running locally) from Windows 7 running on Parallels?
The only thing really necessary is figuring out the IP address of the Mac host, and browse to that IP address on the Windows client machine.
For example, if your Mac host has the IP address 10.0.1.35, you should be able to browse to http://10.0.1.35
.
If you have configured a firewall on the Mac, you probably want to disable that, or allow communication on port 80 to pass.
If you have configured named based virtual hosts in Apache, additionally you'll want to add entries to Windows' hosts file in %SystemRoot%\system32\drivers\etc\hosts
, for example:
10.0.1.35 epwbst
First ensure you have set the type of your VM network as "Shared Network" (in Parallels open the VM Configure window > Hardware > Network). Don't know if it works with another network type.
From Parallels: browser test your OS X localhost:
Parallels creates a little DHCP network for your virtual machines, and the OS X machine itself is at the gateway IP. Go into Parallels > Preferences > Advanced > Network and the gateway is most likely the Start Address with a 0, 1 or 2 in front of it. For example, my Start Address is
10.211.55.1
and in Internet Explorer I typehttp://10.211.55.2
to hit the webserver I have running on OS X athttp://localhost:80
.
So, go to your guest OS (Windows) and edit the hosts
file (on Windows it's located at C:\Windows\system32\drivers\etc\hosts
) to enter this Parallels gateway IP (in my case 10.211.55.2
) and name of the VirtualHost you've configured in Apache:
10.211.55.2 myvirtualhostname.localhost
10.211.55.2 myvirtualhostname2.localhost
This does the trick as that IP address is going to be maintained by Parallels and will not change as you change your location.
Now you can access to myvirtualhostname.localhost
(or whatever your VirtualHost is named on Apache) from guest's browser.