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

Sam*_*rai 5 virtualhost apache-2.2

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

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

我真的不想为/var/www/html.

另一个注意事项...我已添加NameVirtualHost *:80httpd.conf.

任何想法为什么虚拟主机回答这个?

==> axxx-http.conf <==

<VirtualHost *:80>
ServerAdmin beren@xxyy.com
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
Run Code Online (Sandbox Code Playgroud)

Mat*_*erg 7

当您开始在网络服务器上使用虚拟主机时,您也必须为普通服务器创建一个虚拟主机。如果您不创建,则定义的第一个虚拟主机将是与另一个虚拟主机 ServerName 或 ServerAlias 指令不匹配的服务器的任何连接的默认主机。

检查此 URL 上的“主要主机消失”部分以获取此解释:http :
//httpd.apache.org/docs/2.2/vhosts/name-based.html