Order of VirtualHost entries in httpd.conf ?

Qbist

Member
May 5, 2015
5
0
1
Vienna
cPanel Access Level
Root Administrator
Is there a way to control the order of VirtualHost entries in httpd.conf?

Background:
I've setup a virtualhost with a wildcard ServerAlias (*.mydomain.com).
Additionally there is a virtualhost (cPanel SubDomain) called blog.mydomain.com.

This worked fine until the httpd.conf file was apparently newly generated and the order of the virtual domains magically changed, causing blog.mydomain.com to redirect to the wildcard virtualhost.
 

Qbist

Member
May 5, 2015
5
0
1
Vienna
cPanel Access Level
Root Administrator
Thank you for the link.

So is the solution that when I manually change the order in httpd.conf (which I did as temporary workaround), the following script would somehow magically preserve the order of the VirtualHost entries?

/usr/local/cpanel/bin/apache_conf_distiller --update
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello,

Right, the Apache distiller is used to preserve changes to the Apache configuration file.

Thank you.
 

Qbist

Member
May 5, 2015
5
0
1
Vienna
cPanel Access Level
Root Administrator
Unfortunately this didn't work.

I've tried:
- changing the order of the VirtualHost entries and run apache_conf_distiller --update
- manually adding a VirtualHost entry and run apache_conf_distiller --update

Both changes where lost the next time the configuration was automatically created

As alternative, what determines in WHM in what order the VirtualHost entries are generated?
Is it possible to use some prefix or change the order in a database to get this permanently resolved?