28

I'm using a wildcard subdomain to manage most of my requests but I'm running into an issue of getting one of my subdomains (let's say, wiki.domain.com) to load first.

I understand that loading this inside an httpd.conf or something would just be a case of resorting which VirtualHosts load first, but I am using a2ensite and sites-available to manage my domains (individual files for each domain), which, to my knowledge, means I have no real way of determining which domains are "loaded" first.

I am running Ubuntu Hardy.

Jake Bellacera
  • 884
  • 1
  • 9
  • 18

3 Answers3

39

I believe the order of loading is from the name of the configuration file in the /etc/apache2/sites-enabled directory. so if you wanted one loaded first, you would name the file 000-wiki.domain.com (or a2ensite 000-wiki.domain.com)

Out of curiosity, why does the order matter for you?

Wolfram
  • 8,044
  • 3
  • 45
  • 66
Rob Di Marco
  • 43,054
  • 9
  • 66
  • 56
  • 1
    I'm not entirely sure, honestly. I'm just going about trying to figure out why the wildcard subdomain is shadowing the static subdomain and this just seemed like a logical conclusion. Also, your suggestion solved this issue! Thanks! (p.s. I'd vote you up but I don't have 15 rep yet :/ me = newbie) – Jake Bellacera Aug 25 '10 at 18:12
  • 30
    The order matters because the first Vhost config has the highest priority and will be the one that gets used when others' names can't be matched: http://httpd.apache.org/docs/2.2/vhosts/examples.html – Goro Nov 05 '12 at 22:54
  • @bshea There's a comment from 4 years ago that already says this – Michael Mrozek Apr 21 '16 at 19:59
34

To check the currently loaded virtualHosts (and their load order):

httpd -S

on an Ubuntu OS you can also use the following:

apache2ctl -S
Meetai.com
  • 6,622
  • 3
  • 31
  • 38
  • 1
    `sudo apache2ctl -S` -- unless you enjoy chasing down [false alarm](https://serverfault.com/a/416613/161152) error messages. – Bob Stein Apr 07 '21 at 13:23
1

(Because this question is related to system administration, it's better suited for serverfault.com.)

Under Debian and Ubuntu's default configuration, sites are loaded in alphabetical order (using Apache's Include directive), so you can change the order in which your sites load by changing their names. (For example, the default site that Debian provides is actually named 000-default, to make it very likely that it will load first.)

Community
  • 1
  • 1
Josh Kelley
  • 56,064
  • 19
  • 146
  • 246