1, 打开服务器Apache下的
httpd.conf 搜索vhosts
如下:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
删除这一行前面的# 变成
# Virtual hosts
Include conf/extra/httpd-vhosts.conf打开注释 开启虚拟主机的配置
2, 打开C:\Windows\System32\drivers\etc 的hosts
如下:
127.0.0.1 localhost
新增一行
127.0.0.1 你的域名 例如www.baidu.com
3, 打开D:\wamp\bin\apache\apache2.2.22\conf\extra
文件夹下的httpd-vhosts.conf
如下:
<VirtualHost *:80>
ServerAdmin www.baidu.com
DocumentRoot "d:/wamp/www/"
ServerName www.baidu.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
复制一个修改成为:
<VirtualHost *:80>
ServerAdmin www.baidu.com
DocumentRoot "d:/wamp/www/"
ServerName www.baidu.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
以后想打开项目可以直接输入你设置的域名
www.baidu.com
网友评论