先看看你的httpd.conf里面有没有" Include conf/default/httpd-vhosts.conf ",就是引入虚拟主机配置文件的。
有的话,就编辑apache目录下面的conf/default/httpd-vhosts.conf 文件。里面的内容就是你看到的设置虚拟主机的内容。
下面的是我的内容,语句前面加# 就是注释掉的意思。
<VirtualHost *:80>
ServerAdmin
mail@126.com
DocumentRoot E:\phproot\vhosts\viahim //这个就是你的网站的目录\和/效果一样
ServerName viatop.cn
ServerAlias
www.viatop.cn
ErrorLog logs/viatop.cn-error_log
CustomLog logs/viatop.cn-access_log combined env=!IMAG
</VirtualHost>
设置好之后,重启apache。