Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Feb 2003
    Posts
    165

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

    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!
    Thomas Tremain

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2008
    Location
    PK
    Posts
    443

    Default

    Quote Originally Posted by ttremain View Post
    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!

    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.
    1 solution works for all problems. Trying harder!
    HostMasterTips - Understanding Tech Support

  4. #4
    Member
    Join Date
    Feb 2003
    Posts
    165

    Default

    Quote Originally Posted by cPanelDavidG View Post
    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?
    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
    Thomas Tremain

  5. #5
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by ttremain View Post
    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
    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. #6
    Member
    Join Date
    Feb 2003
    Posts
    165

    Default

    Quote Originally Posted by JPC-Howard View Post
    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.
    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
    Thomas Tremain

  7. #7
    Member
    Join Date
    Feb 2003
    Posts
    165

    Default

    Quote Originally Posted by cPanelDavidG View Post
    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.
    Then I will just make a recomendation that they move either this wildcard subdomain, or the static subdomains, to a different server. Problem solved.
    Thomas Tremain

Similar Threads & Tags
Similar threads

  1. Faulty httpd.conf - can't rebuild with rebuildhttpd.conf
    By movielad in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 03-21-2011, 12:43 PM
  2. Preserve amends to /etc/httpd/conf/httpd.conf ?
    By robocrop in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-14-2010, 02:08 AM
  3. Using www. in ServerName - httpd.conf ?
    By trevHCS in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-20-2008, 12:22 PM
  4. EasyApache breaks httpd.conf (removal of www.domainname in Alias)
    By meganet in forum cPanel and WHM Discussions
    Replies: 20
    Last Post: 02-27-2008, 01:18 AM
  5. Sites have disappeared. Can not write to httpd conf.
    By Baccardi in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 09-23-2003, 02:41 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube