Apache虚拟目录配置

要更改虚拟目录的位置,需要到apache的配置文件中更改(conf/httpd.conf)

在phpstudy中,httpd.conf和vhost.conf都有配置虚拟目录的指令,并且两个配置文件中都有配置虚拟目录的指令,为了测试,我们注释掉vhost.conf的引入

更改虚拟目录

<VirtualHost _default_:80>
  DocumentRoot "C:\web1"       #指定虚拟目录路径
  ServerName www.baidu.com     # 虚拟目录绑定的域名
  DirectoryIndex aa.php        # 默认首页
  <Directory "C:\web1">
    Options -Indexes -FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>


<VirtualHost _default_:80>
DocumentRoot "C:\web2"
 ServerName www.sina.com
 DirectoryIndex bb.php
  <Directory "C:\web2">
    Options -Indexes -FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

猜你喜欢

转载自www.cnblogs.com/ycchao/p/12940113.html