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.

Use custom config apache

Discussion in 'EasyApache' started by Acieke, Nov 13, 2004.

  1. Acieke

    Acieke Member

    Joined:
    Nov 13, 2004
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hello all,

    I have the following problem:
    Some customers of mine want to have a 'catchall' subdomain (*.domain.com --> www.domain.com). But if I just add it in the regular conf, subdomains added after the *. don't work, as the catchall takes them.
    Now I solved it the following way:
    I have created a file catchall.conf with all the *. vhost containers in, and httpd.sub.conf, with Include httpd.conf and Include catchall.conf, and I adjust my init scripts to load httpd.sub.conf.
    This all works, until cpanel gets updated and the init script gets overwrited.

    Now my question: how can I rebuild my apache to use httpd.sub.conf as default? (I hope cpanel still keeps using httpd.conf then...)

    Tnx for your reply,
    Fréderic
     
  2. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    Hello,

    If you add the VirtualHost container containing the wildcard (*.domain.com) AFTER the sub.domain.com VirtualHost Containers, you will find that this works as the config is read in order that it appears within httpd.conf

    You can add all the *. virtualhosts into say wildcard.httpd.conf - no need to mess with any init scripts or anything, just make sure that the Include is at the end of httpd.conf, so the earlier exisiting sub.domain.com entries work.

    Include /usr/local/apache/conf/wildcard.httpd.conf

    At the bottom of httpd.conf and restart apache and you should be all set.
     
    #2 DigitalN, Nov 13, 2004
    Last edited: Nov 13, 2004
  3. Acieke

    Acieke Member

    Joined:
    Nov 13, 2004
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    well, I haven't tried it because I was kinda sure cpanel just throws new vhost containers at the bottom of httpd.conf.. So these will get caught by the wildcard.. But I will try it out

    Tnx for your reply
    Ace
     
  4. Acieke

    Acieke Member

    Joined:
    Nov 13, 2004
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Yup it just throws it at the end of httpd.conf, so It will come below the Include and they still get caught by * :(

    Any help?

    -Ace
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    AFAIK, there's no other solution than the one that DigitalN gave you. cPanel appends new VirtualHost containers and a wildcard ServerAlias has to be the last one for the domain in httpd.conf. You could write a script that parses through httpd.conf and rearranges it for you, otherwise you're out of luck.
     
Loading...

Share This Page