Order of apache virtual host config file

6 posts / 0 new
Last post
#1 Mon, 05/20/2013 - 18:41
instable

Order of apache virtual host config file

Hi I want to know if it's possible to manage the loading order of /etc/apache2/sites-available/FILES in virtualmin? If not it was interesting because the virtual host config file order define the priority of config

For example (in my case) file bar.foo.conf

<virtualhost>
ServerName bar.foo.com
</virtualhost>

file foo.com.conf

<virtualhost>
ServerName foo.com
ServerAlias *.foo.com
</virtualhost>

file gar.foo.conf

<virtualhost>
ServerName gar.foo.com
</virtualhost>

the sub domain bar.foo.com WORK but the gar.foo.com don't because the loading order is alphabetical.

Tue, 05/21/2013 - 16:50
miner

Ambiguous / Conflicting configuration with ServerAlias *.foo.com collides with gar.foo.com

Apache may not be loading gar because it already exists in *.foo.com

If you insist on this configuration, you can manually rename some of the symbolic links to use numeric prefixes as is done with 00-default

Wed, 05/22/2013 - 05:02
instable

Thank to anwser

Yeah i've rename the simlink in /etc/apache2/site-enable/* and it work fine.

But i want to purpose to virtualmin feature. Can set the loading order when i create the virtualhost

have nice day

Mon, 08/05/2013 - 19:38
fnunes

I would also like to see this feature in Virtualmin or Webmin.

Best regards, Fernando Nunes

Tue, 08/06/2013 - 18:21
Locutus

Virtualmin has an option to define a domain as "default for the respective IP address", symlinking it as the alphabetically first Apache domain to load. I suppose this should do what you're trying to achieve?

Tue, 08/06/2013 - 21:46
andreychek

Yup, Locutus is correct -- you can set a default VirtualHost in Apache by logging into Virtualmin, choosing the default domain from the drop-down list, and selecting Server Configuration -> Website Options, and there you can set "Default website for IP address" to "Yes".

-Eric

Topic locked