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

I have a working Django app hosted on my linode (Fedora 15), and I'm attempting to host a php-based site there as well. I'm using name-based virtual hosts to redirect requests based on the host name, but for some reason, every request is going to the Django app. I'm thinking perhaps mod_wsgi is overriding some defaults? Or maybe a syntax error with my virtual hosts (I've tried DocumentRoot with and without quotes)? Here are the relevant parts of my httpd config file:

Name VirtualHost *:80
<VirtualHost *:80>

WSGIDaemonProcess user=apache group=apache

WSGIScriptAlias / "/var/www/html/PollVaultr/"

Alias /static/ "/var/www/html/static/"

<Directory "/var/www/html/static">
    Order allow,deny
    Allow from all

<Directory "/var/www/html/PollVaultr">
    <Files "">
    Order allow,deny
    Allow from all


<VirtualHost *:80>
    DocumentRoot "/var/www/catfacts/"

And here is my script:

import os, sys


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PollVaultr.settings")

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Running httpd -e DEBUG does not reveal any bugs. Here is the tail of my error_log file:

[Fri Feb 24 20:36:42 2012] [info] mod_wsgi (pid=5893): Create interpreter '|'.
[Fri Feb 24 20:36:42 2012] [info] mod_wsgi (pid=5893): Adding '/var/www/html/' to path.
[Fri Feb 24 20:36:42 2012] [info] [client] mod_wsgi (pid=5893, process='', application='|'): Loading WSGI script '/var/www/html/PollVaultr/'.

Any ideas what could be going on? mod_wsgi definitely shouldn't be dealing with requests made to - why won't those requests head to the alternate document root? I should also mention that this is my first time doing sysadmin work, so I'm very new at this! Thanks.

share|improve this question
up vote 1 down vote accepted

If you have not setup the second virtual host properly, or not being found, then Apache will fallback to sending requests to first virtual host it found in configuration.

Are the virtual hosts in same file, different files? If in different files and in sites-available directory, did you actually enable the second site so linked into sites-enabled?

Try adding a syntax error into second virtual host to make sure file is being read.

Also fix your "NameVirtualHost" directive in example, unless that is your problem. Shouldn't have a space in it.

share|improve this answer
All my vhosts are in httpd.conf. I'm using Fedora and it looks like sites-available isn't on Fedora as far as I can tell. I haven't been able to find an equivalent. Update: I changed around my file system so I have /var/www/, /var/www/, and /var/www/ as the three documentroots. Now both sites are down, not sure why... Thanks for your help, by the way! – LBR Feb 25 '12 at 3:50
You didn't fix 'Name VirtualHost *:80' in the example. Is that a mistake in the example or your files? – Graham Dumpleton Feb 25 '12 at 4:14
Ah, that was just a mistake in the example, not the actual files. Anyway, I got it working now - was just a matter of rearranging the filesystem. Thanks! – LBR Feb 25 '12 at 5:17

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.