虚拟主机从同一个网站拉?

我有我的Fedora 8上的httpd.conf,我设置虚拟主机文件。 这是我有什么:

DocumentRoot "/var/www/html" <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> 

然后下面我想安装一个虚拟主机有多个网站在服务器上:

 NameVirtualHost *:80 <VirtualHost *:80> ServerName kadence.tv DocumentRoot /var/www/html/ </VirtualHost> <VirtualHost *:80> ServerName nacc.biz DocumentRoot /var/www/html/nacc/ </VirtualHost> 

也在/ var / www / html /目录我有kadence网站的index.php文件…当我做任何网站我得到的kadence网站的索引…任何想法我做错了什么

编辑我的httpdconfiguration文件的全部内容在这里

如果您使用的名称与其中一个虚拟主机部分不匹配,则会默认使用第一个虚拟主机部分。 我的猜测是你正在访问www.nacc.biz。 www很重要。 名字必须完全匹配。 由于apache没有www.nacc.biz的虚拟主机部分,因此它使用第一个(kadence.tv)作为默认值。

查看ServerAlias指令,并使用它来指定所有您希望使用的服务器名称。

1检查活动的NameVirtualHost 。 打开/etc/apache2/ports.conf文件:

 NameVirtualHost *:80 

2检查DNS

 # ping app.local PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. # ping john.app.local PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. 

3检查Apacheconfiguration(/ etc / apache2 / sites-enabled / 000-default):

 <VirtualHost *:80> ServerName app.local DocumentRoot /var/www <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerName john.app.local DocumentRoot /var/www/john </VirtualHost> $ sudo apache2ctl configtest Syntax OK $ sudo apache2 -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server app.local (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost app.local (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost john.app.local (/etc/apache2/sites-enabled/000-default:12) 

4testingApache:

 $ curl http://john.app.local john $ curl http://app.local <html><body><h1>It works!</h1> <p>This is the default web page for this server.</p> <p>The web server software is running but no content has been added, yet.</p> </body></html>