Apache配置虚拟主机后,不能访问localhost的问题

第一步:
先在httpd-vhosts.conf设置好虚拟域名localhost
<VirtualHost _default_:80>
DocumentRoot "C:\phpStudy\WWW"     
ServerName localhost
</VirtualHost>

第二步:@很重要
把httpd.conf文件的ServerName localhost:80 那行注释掉(就是在前面加#)

第三部:
别忘了查看hosts文件里是否绑定 localhost指向127.0.0.1,一般情况下会存在

第四部:
重启Apache服务

posted @ 2017-10-04 15:20  星火和睦  阅读(502)  评论(0编辑  收藏  举报