WAMP 配置 虚拟主机

今天又遇到配置虚拟主机的问题了,没有及时记下来,很容易就忘记,所以在此做一个记录。其实很简单的。

  1. 编辑httpd.conf,查找Include conf/extra/httpd-vhosts.conf,把前面注释符号“#”删掉。

  2. 编辑httpd-vhosts.conf,注意D:\mik是我的目录,还要加上localhost那个,不然localhost无法访问

<VirtualHost *:80>
    DocumentRoot "D:\mik"
    ServerName mikzone.com
    ServerAlias mikzone.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/"
    ServerName localhost
    ServerAlias localhost
</VirtualHost>
  1. 编辑httpd.conf,添加
<Directory "D:\mik">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Allow,Deny
    Allow from all
</Directory>
  1. 还是修改httpd.conf,不修改会提示 “You don’t have permission to access / on this server.”
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>
  1. 修改host文件,这个就不多说了,网上很容易找到

  2. 重启wampserver即可!

Php
Mikzone