Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

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

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html/

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

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.

share|improve this question
There is not much to go by here, can we get the entire section posted please. – Jacob Jan 30 '11 at 19:31
can you post the messages that you get in your log files when you access each site please. – Iain Jan 30 '11 at 19:46
Question duplicated here:… – Jeff Snider Jan 30 '11 at 19:50
@jacob i posted my entire vhost in the link and if you scroll to the bottom you will see the NameVirtualHost section and the problem is regardless of whichever address i go to or kadence i get the kadence site... – Matt Jan 30 '11 at 19:59
up vote 4 down vote accepted

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 The www is significant. The name has to match exactly. Since apache doesn't have a virtualhost section for, it is using the first one ( as the default.

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

share|improve this answer
did you look at the virtualhost to see if i am doing it wrong – Matt Jan 30 '11 at 20:00

1 Check active NameVirtualHost. Open /etc/apache2/ports.conf file:

NameVirtualHost *:80

2 Check DNS

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

# ping
PING localhost.localdomain ( 56(84) bytes of data.

3 Check Apache config(/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

<VirtualHost *:80>
        DocumentRoot /var/www/john

$ 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 (/etc/apache2/sites-enabled/000-default:12)

4 Test Apache:

$ curl
$ 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>
share|improve this answer
yes i have it posted in my question – Matt Jan 30 '11 at 16:32
I tried that but i ran into errors like Stopping httpd: [FAILED] Starting httpd: Syntax error on line 982 of /etc/httpd/conf/httpd.conf: CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs) – Matt Jan 30 '11 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.