Order of apache virtual host config file

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

ServerName bar.foo.com

file foo.com.conf

ServerName foo.com
ServerAlias *.foo.com

file gar.foo.conf

ServerName gar.foo.com

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

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

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

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

Best regards,
Fernando Nunes

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?

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”.