虚拟域名的配置,三步走搞定
1.在httpd_conf文件中找到以下代码
# Virtual hosts # Include conf/extra/httpd-vhosts.conf
修改为:
# Virtual hosts Include conf/extra/httpd-vhosts.conf //去掉Include前的#
2.在httpd-vhosts文件添加如下代码: //我的是在wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts
<VirtualHost *:80> DocumentRoot "F:/wamp/www/pro1" // 新建项目目录 ServerName www.serytone.class //设置虚拟域名 <Directory "F:/wamp/www/pro1"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
3.在hosts文件添加如下代码:
127.0.0.1 www.serytone.class //使用上面设置的虚拟域名
到这里,虚拟域名的设置就完成啦。