虚拟主机文档根改变整个服务器的web根目录

我目前有example.com指向服务器之一。 我想从一个不同的目录(/ WebData)服务器example.com。

我通过编辑httpd.conf来做到这一点

http://pastebin.com/UjHhRNTX

我这个按需要工作。

然后我发现我需要将website.org添加到服务器。 于是我挂载了另一个磁盘,并创build了一个名为/ WebDataWebsite的目录

并使用以下VHost创build/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的stream量都被引导至/ WebDataWebsite中的index.htm

我做错了什么? 如何使WebData(在httpd.conf中)成为默认的网站,但用VHOST过滤servername website.org?

一旦在端口*:80上定义了第一个虚拟主机,您的所有端口80通信都由该虚拟主机处理,而不是基本的Web服务器configuration。

通常最好的方法是创build两个*:80虚拟主机。 第一个定义的是默认将覆盖你的基本configuration用来处理的一切 – 第二个指定ServerName / ServerAlias来捕获你想要自定义的东西。

用apachectl -S检查你的工作