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.

httpd.conf sites/www.domain.com.conf Wildcard DNS

Discussion in 'Bind / DNS / Nameserver Issues' started by ttremain, Dec 15, 2008.

  1. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    212
    Likes Received:
    0
    Trophy Points:
    16
    I need to make a wildcard virtualhost entry in httpd.conf. However the newer configuration requires me to modify the /usr/local/apache/conf/sites/*.conf files instead. This is no problem. I just need to add ServerAlias *.domain.com

    However, here's where it starts to get sticky. I have other virtualhosts that use the same SLD, forum.domain.com, etc...

    Two questions:

    1) How do I make sure that the virtualhost I'm modifying with the wildcard entry is used LAST in the httpd.conf?

    2) How do I rebuild the httpd.conf after making the change?

    Thank you!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are you just looking to create a wildcard subdomain (*.exmaple.com), or is there more to what you are doing than just creating a wildcard subdomain?
     
  3. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider

    What cPanel version are you using, usually cPanel creates the VirtualHosts by using files in /var/cpanel/userdata/username folder. You can make changes in the /var/cpanel/userdata/username/domain.tld files and create the ServerAlias for wildcard, then you can rebuild the httpd.conf file with these changes by running /usr/local/cpanel/bin/build_apache_conf and then restart the service, the wildcard will work fine. Don't forget to create the wildcard cname in DNS zone file.
     
  4. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    212
    Likes Received:
    0
    Trophy Points:
    16
    Yes, I am just wanting to create the wildcard subdomain, and make sure it ends up in the httpd.conf AFTER any other occurrences of subdmain.domain.com
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Creating the wildcard subdomain is the easy part: just go into cPanel and when creating a subdomain, just create *.example.com (where example.com is a domain). However, cPanel/WHM does not have the mechanisms in place to control where the httpd.conf entries for this are placed. It's generally not recommended to create *.example.com and also create something.example.com in the cPanel interface.
     
  6. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    212
    Likes Received:
    0
    Trophy Points:
    16
    cPanel 11.23.6-R27698

    Will rebuilding the httpd.conf like this ensure that this virtualhost is positioned in the httpd.conf after any other virtualhosts that use a subdomain from this same domain?

    Unless things have changed too drasticly, the wildcard virtualhost, (*.domain.com) should be after any other virtualhosts. (subdoamin.domain.com) in the httpd.conf
     
  7. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    212
    Likes Received:
    0
    Trophy Points:
    16
    Then I will just make a recomendation that they move either this wildcard subdomain, or the static subdomains, to a different server. Problem solved.
     
Loading...

Share This Page