Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

apache

apache2

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.

like image 449
Jake Bellacera Avatar asked Sep 06 '25 03:09

Jake Bellacera


2 Answers

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?

like image 66
Rob Di Marco Avatar answered Sep 08 '25 00:09

Rob Di Marco


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

httpd -S

on an Ubuntu OS you can also use the following:

apache2ctl -S
like image 40
Meetai.com Avatar answered Sep 07 '25 23:09

Meetai.com