Apache虚拟目录的建立

在Apache的安装目录下找到conf下的httpd.conf文件,打开之后查找dir_module,找到如下代码后,

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

在该段代码后添加:

#配置虚拟目录
<IfModule dir_module>
  #directory相当于是欢迎页面
  DirectoryIndex index.html index.htm index.php
  #你的站点别名
  Alias /MyApache "D:/MyApache"
  <Directory d:/MyApache>
  #这里访问权限设置
  Order allow,deny
  Allow from all
  </Directory>
</IfModule>

其中的<Directory d:/MyApache>中设置的是你的虚拟web站点存放的位置。

然后查找DocumentRoot,找到DocumentRoot "D:/AMP/Apache/htdocs"

其中,D:/AMP/Apache/htdocs是作者自己的电脑上安装Apache的路径下面的默认web路径。

在DocumentRoot "D:/AMP/Apache/htdocs"前面加#注销掉该句。

原文地址:https://www.cnblogs.com/wyh3721/p/2525041.html