I am running Apache with several virtual hosts on my Mac. I think the virtual hosts have properly been configured; thus, I can access the following from the web browser:
host1.mydomain
host2.mydom开发者_JS百科ain
host3.mydomain
I can also access localhost
with no problem.
However, I can't access those hosts from a virtual machine (I use Parallels Desktop, running on the same box). Do I need to configure something on my virtual machine? Maybe the hosts file, etc.?
Is it also possible to hit those hosts from the virtual machine, even I am not connected to the Internet?
Thanks.
It turns out this can be solved by simply updating the hosts file in the VM.
Assuming the Mac's IP is a.b.c.d and you want to access host1.mydomain
, you'd need to add this line to the hosts file (in the VM):
a.b.c.d host1.mydomain
So, when you type in host1.mydomain
on the VM browser, it will get resolved to the host running on the Mac.
精彩评论