Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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

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

  1. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    166
    cPanel Access Level:
    Root Administrator
    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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,216
    Likes Received:
    10
    Trophy Points:
    313
    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:
    458
    Likes Received:
    6
    Trophy Points:
    68
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    166
    cPanel Access Level:
    Root Administrator
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,216
    Likes Received:
    10
    Trophy Points:
    313
    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:
    216
    Likes Received:
    0
    Trophy Points:
    166
    cPanel Access Level:
    Root Administrator
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. ttremain

    ttremain Well-Known Member

    Joined:
    Feb 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    166
    cPanel Access Level:
    Root Administrator
    Then I will just make a recomendation that they move either this wildcard subdomain, or the static subdomains, to a different server. Problem solved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice