Virtualhost pulling from the same site

apache-2.2fedorahttpd.confvirtualhost

I have my httpd.conf on fedora 8 that I am setting the virtual host file. Here is what I have:

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>

then below I am trying to setup a vhost to have multiple sites on the server:

NameVirtualHost *:80

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

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

also in the /var/www/html/ directory I have the index.php file for the kadence site…when I do to either site I get the index for the kadence site…any ideas what I am doing wrong

EDIT the full contents of my httpd configuration file are here.

Best Answer

If the name you're using doesn't match one of the virtualhost sections, it will default to using the first one. My guess would be that you're accessing www.nacc.biz. The www is significant. The name has to match exactly. Since apache doesn't have a virtualhost section for www.nacc.biz, it is using the first one (kadence.tv) as the default.

Take a look at the ServerAlias directive, and use it to specify all of the server names you expect to use.

Related Topic