Apache配置虚拟主机后,不能访问localhost,只能通过设置好虚拟域名访问。
(1)可以通过把localhost变成虚拟域名。
<VirtualHost _default_:80>
DocumentRoot "C:\phpStudy\WWW"
ServerName localhost
</VirtualHost>
(2)把httpd.conf文件的ServerName localhost:80 那行注释掉
(3)查看hosts文件里是否绑定 localhost指向127.0.0.1,一般情况下会存在