Virtualhost Document Root 更改整个服务器的 Web 根目录

Virtualhost Document Root changing web root for entire server

我目前 example.com 指向服务器一。我想从另一个目录 ( /WebData )

服务器 example.com

我通过编辑 httpd.conf

做到了这一点
http://pastebin.com/UjHhRNTX

我这个工作正常。

然后我发现我需要将 website.org 添加到服务器。所以我安装了另一个磁盘并创建了一个名为 /WebDataWebsite

的目录

并使用以下 VHost 创建了 /etc/httpd/conf.d/websiteorg.conf

http://pastebin.com/GTmqtABf

<VirtualHost *:80>
       DocumentRoot "/WebDataWebsite"
       ServerName website.org
       ServerAlias www.website.org
       <Directory "/WebDataWebsite">
               Require all granted
       </Directory>
</VirtualHost>

出于某种原因,example.com 和 website.org 的所有流量都被定向到 /WebDataWebsite

中的 index.htm

我做错了什么?如何使 /WebData(在 httpd.conf 中)成为默认网站,但使用 VHost 按服务器名 website.org 过滤?

您可能需要为第二个站点使用别名。看看http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

VH 的第二个声明不太可能被 apache 获取,因为我相信它无法处理相同的两个声明。