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

So I have 2 configuration files.


<VirtualHost *:80>
        ServerAlias *
        DocumentRoot    /var/www/mysite/www
        ErrorDocument 404 /redirect.php
    ErrorLog    logs/application/mysite.error_log
    CustomLog   logs/application/mysite.access_log Combined


<VirtualHost *:80>
        DocumentRoot    /var/www/videouploader/www
    ErrorLog logs/application/videoupload.error_log
    CustomLog logs/application/videoupload.access_log Combined

See, we have about 50 possible subdomains, all that do different things, but they're all served off the same document root.

I'd like to keep * in there, simply because its cleaner then having the worlds longest serveralias line, plus it protects from retards trying or something that wouldn't work.

I've read through the apache documentation and it didn't really have anything for this senario. Anyone know how to do this?

share|improve this question
up vote 4 down vote accepted

Apache searches for vhost matches from top to bottom and actions the firsh match that it encounters. If you renamed videoupload.conf to 0videoupload.conf it would be read before mysite.conf and it should just work.

share|improve this answer
Not thrilled by HOW that worked, but thanks. – GruffTech Jul 15 '11 at 15:47
@GrufTech: Your other option is to put all your definitions in one file in the order you want them read. – Iain Jul 15 '11 at 15:50
Thats actually what I did, after I figured out apache reads top to bottom. A single file with the subdomains above the *. – GruffTech Jul 15 '11 at 15:52

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.