开启了httpd-vhosts.conf,默认的httpd.conf默认配置失效(确保 httpd-vhosts.conf 文件里也开启了虚拟主机配置,见第3条),访问此IP的域名将全部指向 vhosts.conf 中的第一个虚拟主机。
1、首先修改C盘WINDOWS\system32\drivers\etc目录下的 hosts 文件,用记事本打开,加入:
127.0.0.1 localhost
127.0.0.1 www.mydomain.com
2、httpd.conf中打开httpd-vhosts.conf
3、在虚拟主机设置文件xampp\apache\conf\extra\httpd-vhosts.conf里设置:
取消 NameVirtualHost *:80 前面的 ##
参考如下配置
<VirtualHost *:80>
ServerAdmin admin@send2ocean.com
DocumentRoot "D:/Apps/zend-eclipse-php/workspace"
<Directory "D:/Apps/zend-eclipse-php/workspace">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
ServerName send2ocean.com
ErrorLog "logs/send2ocean.com-error.log"
CustomLog "logs/send2ocean.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
原文地址:http://3409736.blog.51cto.com/3399736/1411244