1.找到Apache的\conf目录下的httpd.conf文件,打开它,找到下面这两行:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
把它改成下面这样:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2.找到Apache的\conf\extra目录下的httpd-vhost.conf这个文件。
<VirtualHost *:80>
DocumentRoot "D:\softwhere\wamp\www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\softwhere\wamp\www\public_html"
ServerName www.xx.com
</VirtualHost>
3.C:\WINDOWS\system32\drivers\etc目录下的hosts文件
127.0.0.1 localhost
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
把它改成下面这样:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2.找到Apache的\conf\extra目录下的httpd-vhost.conf这个文件。
<VirtualHost *:80>
DocumentRoot "D:\softwhere\wamp\www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\softwhere\wamp\www\public_html"
ServerName www.xx.com
</VirtualHost>
3.C:\WINDOWS\system32\drivers\etc目录下的hosts文件
127.0.0.1 localhost
127.0.0.1 www.xx.com
如果按照上述的操作localhost无法使用就找到
Apache的\conf目录下的httpd.conf文件,打开它
#ServerName localhost:80
注释改行
重启服务