另一种方法是ssh进入您的虚拟机。使用ifconfig查找接口使用的IP地址。
编辑您的主机文件(C:\ Windows \ System32 \ drivers \ etc \ hosts)。
以我为例,它看起来像这样:
$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:2d:c7:28
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2d:c728/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2268 errors:0 dropped:0 overruns:0 frame:0
TX packets:1958 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:222404 (222.4 KB) TX bytes:215264 (215.2 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:74:21:fb
inet addr:192.168.50.4 Bcast:192.168.50.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe74:21fb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:601 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:173019 (173.0 KB) TX bytes:1824 (1.8 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:190 (190.0 B) TX bytes:190 (190.0 B)
将此添加到主机:
192.168.50.4 vvv.dev
192.168.50.4 local.wordpress.dev
192.168.50.4 local.wordpress-trunk.dev
192.168.50.4 src.wordpress-develop.dev
192.168.50.4 build.wordpress-develop.dev