虚拟主机的DocumentRoot没有被改变 [英] virtual hosts DocumentRoot not being changed

查看:611
本文介绍了虚拟主机的DocumentRoot没有被改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

别以为我的虚拟主机的正常工作。这是我的httpd.conf里面......这是文件中的最后一件事:

Don't think my virtualhost is working correctly. This is what I have inside of httpd.conf...it is the last thing in the file:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/testing
ServerName testing.aa.local
</VirtualHost>

在我的/ etc / hosts文件:

In my /etc/hosts file:

127.0.0.1 testing.aa.local

现在,当我去testing.aa.local它显示的站点的根目录的索引页。在httpd.conf文档根目录为的DocumentRoot的/ var / www / html等。看来它走的文档根目录,而不是虚拟主机的DocumentRoot。当我重新启动httpd的没有错误。当我说的httpd -S它说:

Now when I go to testing.aa.local it shows the index page of the root of the site. In httpd.conf the document root is DocumentRoot /var/www/html. It appears it is taking that document root and not the VirtualHost documentroot. When I restart httpd there are no errors. When I say httpd -S it says:

$ sudo /usr/sbin/httpd -S 
VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers:
_default_:443          aa.local (/etc/httpd/conf.d/ssl.conf:81)
*:*                    aa.local (/etc/httpd/conf/httpd.conf:974)
*:80                   is a NameVirtualHost
         default server testing.aa.local (/etc/httpd/conf/httpd.conf:1031)
         port 80 namevhost testing.aa.local (/etc/httpd/conf/httpd.conf:1031) Syntax OK

任何人都明白,为什么当我去testing.aa.local它显示我的/ var / www / html等,而不是在/ var / www / html等/测试的索引页?同样,在/ var / www / html等被定义为在httpd.conf文件DocumentRoot的,但后来我宣布虚拟主机容器,所以我认为它应该覆盖?

Anyone understand why when I go to testing.aa.local it is showing me the index page of /var/www/html rather than /var/www/html/testing? Again, /var/www/html is defined as the httpd.conf file as the DocumentRoot but later on I declare the virtualhost container and so I thought it should overwrite it?

推荐答案

在我的httpd.conf文件中有一个虚拟主机的容器都准备好了。我评论它,它现在的作品。

In my httpd.conf file there are a virtualhost container all ready. I commented it out and it now works.

这篇关于虚拟主机的DocumentRoot没有被改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆