开发者

Is there any way I could change the order of which Apache VirtualHosts load first?

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.


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?


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

httpd -S

on an Ubuntu OS you can also use the following:

apache2ctl -S


(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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜