一,httpd.conf修改监听端口,比如8090
Listen 0.0.0.0:8090
Listen [::0]:8090
二,httpd.conf 中,去掉
Include conf/extra/httpd-vhosts.conf
前面的注释.
三,修改D:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
,注意,不同版本,可能所在目录不同.注意查找
在里面增加或修改.类似,表示这样访问时,http://127.0.0.1:8090/index2.html,会定位到d:/wamp/www/dux/egret/index2.html
同时,解析了一个ip地址为127.0.0.18的www.viq.com的本地子域名,访问时,会自动定位到D:/wamp/www/viq目录中,默认是80端口的.
<VirtualHost *:8090>
DocumentRoot "d:/wamp/www/dux/egret"
ServerName 127.0.0.1
ServerAlias localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "D:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.18>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "D:/wamp/www/viq"
ServerName www.viq.com
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "D:/wamp/www/viq">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
四,如果开启了上面所说的www.viq.com子域名,则需要修改windows系统的C:\Windows\System32\drivers\etc\hosts文件.
增加
127.0.0.18 www.viq.com