开发者

Accessing Virtual Hosts from a VM (Running on the Same Box)

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:

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜