Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Im new to apache configuration and would be really glad if someone helped me with the following.Im running apache on a virtual private server, running the debian operating system.

In /etc/apache2/sites-available, i have two virtual hosts defined, and In /etc/apache2/sites-enabled,i have a symlink to . The virtual hosts are defined as follows:

<VirtualHost *:80>
  DirectoryIndex index.html index.htm index.php
  DocumentRoot /var/www/site1
        <Directory /var/www/site1>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
  LogLevel warn
  ErrorLog /var/log/apache2/site1_error.log
  CustomLog /var/log/apache2/site1_access.log combined
  ServerSignature Off

<VirtualHost *:80>
  ServerAdmin hostmaster@wharfage
  DirectoryIndex index.html index.htm index.php
  DocumentRoot /var/www
  LogLevel debug
  ErrorLog /var/log/apache2/site2_error.log
  CustomLog /var/log/apache2/site2_access.log combined
  ServerSignature Off

  <Location />
    Options -Indexes

  Alias /favicon.ico /srv/site2/static/favicon.ico

  Alias /static /srv/site2/static
#  Alias /media  /usr/local/lib/python2.5/site-packages/django/contrib/admin/media

Alias /admin/media /var/lib/python-support/python2.5/django/contrib/admin/media 

  WSGIScriptAlias / /srv/site2/wsgi/django.wsgi

  WSGIDaemonProcess site2 user=samj group=samj processes=1 threads=10
  WSGIProcessGroup site2

However, a strange thing is happening. Im able to navigate to as expected. It loads the content in /var/www/site which i have defined as the DocumentRoot in But if i navigate to,instead of loading index.html which is present in /var/www, which is defined as the DocumentRoot for, as shown above, it loads the content in /var/www/site1. The url in the address bar remains So, i have the following two questions :

Q.1) Why is showing the contents of /var/www/site1 when the DocumentRoot for it has been defined as /var/www ?

Q.2) Since, does not have a symlink in sites-enabled, how come im able to navigate to ?

Sorry, if my questions sound noobish, but ill be really happy if someone could explain this.

Thank You.

share|improve this question

It doesn't matter what address you use. If the IP address is the same, you could use and still access site1. The first VirtualHost will be served for all hostnames that don't match any ServerName or ServerAlias. You need to symlink the file (or use a2ensite) to be able to access it.

share|improve this answer
Thanks for the reply Tomas :). Your explanation is clear to me.I did a2ensite in /etc/apache2/sites-available. That automatically created a symlink for that file in sites-enabled. I then did /etc/init.d/apache2 reload.But now when i navigate to, i get 404 Not Found . Any way to fix this ? – qubit Nov 23 '09 at 20:42
That is likely because you have WSGIScriptAlias for '/' and so all requests going through to Django. In other words, you have configured it so that Django takes precedence other static index.html. You will have to be clearer about how you want it to work if you don't want that. – Graham Dumpleton Nov 23 '09 at 22:23

Your Answer


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