同一台电脑,家里和公司访问虚拟主机速度竟然不一致。
hosts文件里已手动添加 example.com 127.0.0.1
apache配置文件中添加
<VirtualHost *:80>
DocumentRoot "D:/example"
ServerName example.com
</VirtualHost>
hosts文件里已手动添加 example.com 127.0.0.1
apache配置文件中添加
<VirtualHost *:80>
DocumentRoot "D:/example"
ServerName example.com
</VirtualHost>
hosts文件里已手动添加 example.com 127.0.0.1
那么 example.com 访问到的就是你作此设置的机器,如果家里和公司访问虚拟主机速度竟然不一致那只能是“携带途中碰坏了”
hosts 的作用就是绕过 DNS
out line from /etc/hosts, and the Network Information Service (NIS or YP), depending upon the contents of the order line in /etc/host.conf.
(See resolv+(8)). The default action is to query named(8), followed by /etc/hosts.意思就是先默认是先/etc/hosts,然后DNS,可以配置hosts.conf配置这个先后顺序。