一、开启虚拟主机:
在apache的配置文件httpd.conf中将Include conf/extra/httpd-vhosts.conf这行打开。
二、配置虚拟主机:
在extra/httpd-vhosts.conf中添加如下代码
<VirtualHost *:80> DocumentRoot "F:/wamp/www/azw_for_thinkphp" ServerName local.xyb.com DirectoryIndex index.shtml index.html index.htm index.php <Directory "F:/wamp/www/azw_for_thinkphp"> #Options Indexes FollowSymLinks Options FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> </VirtualHost>
三、注释掉httpd.conf中的 DocumentRoot:''
四、将ip地址与虚拟域名关联起来
在c:/Windons/System32/drivers/etc/hosts文件的末尾添加一行
127.0.0.1 local.xyb.com