不需要修改apache 的主配置文件,直接修改 vhosts文件添加入下内容即可
<VirtualHost *:80>
ServerAdmin 101.227.253.218
DocumentRoot "E:/asd" #E盘下空的目录
<Directory "E:/asd"> #E盘下空的目录
AllowOverride None
Order Deny,Allow
Allow from 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin 101.227.253.218
Servername www.science-mall.com #我的域名
DocumentRoot "E:/xampp/htdocs" #真实网站程序
<Directory "E:/xampp/htdocs/"> #真实网站程序
Options Indexes FollowSymLinks Includes ExecCGI #下面这三条是复制主配置的
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
转载于:https://blog.51cto.com/harles/1405160