xampp 虚拟主机
1、首先找到C:\Windows\System32\drivers\etc下的hosts文件
追加内容 本机地址 访问域名
如:127.0.0.1 www.myphp.com
2、修改.httpd.conf文件
<VirtualHost *:80>
ServerName www.myphp.com
DocumentRoot "项目绝对路径 如:G:\xampp\htdocs\myphp"
<Directory "项目绝对路径 如:G:\xampp\htdocs\myphp">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
3、也可以不修改httpd.conf文件
改为修改httpd-vhosts.conf
保存文件,并在XAMPP安装目录中找到apache文件夹——>conf文件夹——>httpd.conf文件,用记事本或者Notepad++打开,找到 #Include “conf/extra/httpd-vhosts.conf” 将前面的#去掉,然后保存文件。
4、修改完之后可能会出现访问localhost无法访问本机需要在第二部之前配置一下
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/
ServerName localhost
</VirtualHost>
以上是我的笔记 下面我之前查到的:
http://www.cnblogs.com/hi-bazinga/archive/2012/04/23/2466605.html