虚拟主机的配置步骤:
第一步:找到apache中conf文件夹下的httpd.conf 并打开
修改的地方:
#先注销 待会再回复
#DocumentRoot "D:/AppServ/www"
# Virtual hosts 启动虚拟主机
Include conf/extra/httpd-vhosts.conf
第二步:在apache中conf中的extra文件夹下 找到 httpd-vhosts.conf
修改的地方:(在文件的最后面添加以下代码)
#配置虚拟主机
<VirtualHost 127.0.0.1:6666>
DocumentRoot "d:/myblog"
DirectoryIndex news.html index.html index.htm index.php
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
第三步:在windows------->system32--->driveers----->hosts 打开
在文件的最后添加: 127.0.0.1 www.kkk.com
第四步:测试 http://localhost:6666/news.html
说明:6666是httpd.conf文件中设置的端口号,可以修改 ,news.html是d:/myblog
文件夹下的一个html文件