当我浏览到IP地址时,Apache VirtualHost应答

我有一个标准的RHEL6版本,我曾经可以使用IP地址浏览到服务器的DocumentRoot

我已经添加了这两个虚拟主机(只显示顶部)。 由于某种原因,现在当我访问服务器的IP地址时,Vhost会回答并使用错误的DocumentRoot

我真的不想为/var/www/html显式定义一个Vhost。

另一个说明…我已经将NameVirtualHost *:80添加到httpd.conf

任何想法,为什么鬼是回答这个?

 ==> axxx-http.conf <== <VirtualHost *:80> ServerAdmin [email protected] ServerName xxyy.com ServerAlias www.xxyy.com DocumentRoot /var/www/site <Directory /var/www/site> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all ==> axxx-ssl.conf <== <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName xxyy.com ServerAlias www.xxyy.com ServerAlias admin.xxyy.com DocumentRoot /var/www/site <Directory /var/www/site> Options Indexes FollowSymLinks MultiViews AllowOverride All 

当您开始在networking服务器上使用虚拟主机时,您也必须为普通服务器创build一个虚拟主机。 如果不创build一个虚拟主机,那么定义的第一个虚拟主机将成为与服务器的任何连接的默认主机,而不与其他虚拟主机ServerName或ServerAlias指令相匹配。

查看此URL的“ 主持人离开 ”部分以获取此解释:
http://httpd.apache.org/docs/2.2/vhosts/name-based.html

*:80表示虚拟主机在每个IP的端口80上应答。 如果打算使用基于名称的虚拟主机,则必须将缺省定义为缺省 :80。 您不能在同一端口上同时使用vhost和非vhostconfiguration。