The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Order of VirtualHost entries in httpd.conf ?

Discussion in 'Bind / DNS / Nameserver Issues' started by Qbist, May 5, 2015.

  1. Qbist

    Qbist Member

    Joined:
    May 5, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  2. Qbist

    Qbist Member

    Joined:
    May 5, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  4. Qbist

    Qbist Member

    Joined:
    May 5, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  5. Qbist

    Qbist Member

    Joined:
    May 5, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Vienna
    cPanel Access Level:
    Root Administrator
    Thanks. That's what I ended up doing. Bit of a hack but it seems to work..

    Still wonder if there is a cleaner way of setting the VirtualHost order?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    There's no easier methods I'm aware of, but it's a good idea for a feature request:

    Submit A Feature Request

    Thank you.
     
  7. Qbist

    Qbist Member

    Joined:
    May 5, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Vienna
    cPanel Access Level:
    Root Administrator

Share This Page