Accessing Mac virtual hosts from a Parallels VMNovember 20th, 2015
Firstly I am assuming that you have a working local website setup and that you are comfortable setting up apache virtual hosts. Setting up a virtual host from a Parallels Windows VM allows you to locally test your website using a different OS and browser.
1. From within Parallels, click the gear icon from the VM or Configure from the menu.
Go to Hardware -> Network 1 -> and set Type = Shared Network.
2. From the Mac you need the Mac’s virtual IP address which you can obtain by running the command “ifconfig vnic0” [without the quote marks] from within Terminal.
My Mac’s virtual IP address is 10.211.55.2
From the Windows VM, access the hosts file which you can find at C:\Windows\System32\drivers\etc\hosts Add the line [Your virtual IP address] followed by your testing domain. In my case it looks like this and it has a tab between the IP and the domain which I cannot show here:
My finished hosts file looks like this and the only change made was the last line:
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 184.108.40.206 rhino.acme.com # source server
# 220.127.116.11 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost