1、打开Apache2 安装目录下的\conf\extra\, 找到 httpd-vhosts.conf 文件加入
<囊兼何VirtualHost *:80>
DocumentRoot "D:\WWW\demo"
ServerName demo.com
ServerAlias
<Directory "戴净D:\WWW\bsxs">
露菌 Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
如图:

2、打开 httpd.conf 文件,Include conf/extra/httpd-vhosts.conf在470行的位置去掉前面的#号,如图:

3、最后重启apache生效。