apache-安装VirtualHost后,无法在DocumentRoot中查看页面

apache-安装VirtualHost后,无法在DocumentRoot中查看页面,apache,virtualhost,Apache,Virtualhost,在httpd.conf中设置VirtualHost后,我无法访问DocumentRoot中的页面,所有请求都被转发到定义的VirtualHost DocumentRoot "/usr/local/www/apache24/data" <Directory "/usr/local/www/apache24/data"> Options Indexes FollowSymLinks AllowOverride None Require all granted </

在httpd.conf中设置VirtualHost后,我无法访问DocumentRoot中的页面,所有请求都被转发到定义的VirtualHost

DocumentRoot "/usr/local/www/apache24/data"
<Directory "/usr/local/www/apache24/data">
  Options Indexes FollowSymLinks   
  AllowOverride None
  Require all granted
</Directory>

<VirtualHost *:80>
    ServerName sub.domain.site     
    DocumentRoot /usr/local/www/apache24/data/sub_domain_site/ 
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /usr/local/www/apache24/data/sub_domain_site/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

</VirtualHost>

请注意,VirtualHost有一个DNS条目,因此可以使用其名称在internet上访问。但是,我现在需要完成的是通过服务器IP访问存储在apache默认DocumentRoot中的页面。

我已经在当前定义的子域VirtualHost之后添加了另一个VirtualHost块。在新的文档中,我输入了ServerName[IP-ADDRESS],并将其指向apache默认DocumentRoot。效果很好

所以我想知道我是不是用正确的方法做的?有没有更好的办法

谢谢