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.

How to make Wildcard Subdomains?

Discussion in 'General Discussion' started by echo_unlimited, Dec 24, 2006.

  1. echo_unlimited

    Joined:
    Dec 24, 2006
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello,

    One of my free webhosting users asked me if I could create a "Wildcard subdomain" for him, as he was wanting to run a short URL script. Could some one please give me a short tutorial on how to create this Wildcard Subdomain, anyhelp would be appreciated. This is what the user posted about this request of his:

    Would I need root access of some sort if I were set up these wildcard subdomains?

    Thank you, (I hope some one can assist me on this)

    -echo_unlimited

    Edit: I've used the search feature, but I cannot find a thread which I can undestand, I need this explained in simple terms as I do not understand how to do a wildcard subdomain. :( I don't even know what a wildcard domain is or what it can do. It's very new to me.
     
  2. tweakservers

    tweakservers Well-Known Member

    Joined:
    Mar 30, 2006
    Messages:
    379
    Likes Received:
    0
    Trophy Points:
    16
    you will need to have access to the DNS zone file to edit the DNS zone for that domain by adding this:

    * IN A ShareDomainIP

    Replace ShareDomainIP with the IP that the domain is currently resolving to when you ping domain.com
     
  3. Vinayak

    Vinayak Well-Known Member

    Joined:
    Jun 27, 2003
    Messages:
    267
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Bharat
    cPanel Access Level:
    Root Administrator
  4. echo_unlimited

    Joined:
    Dec 24, 2006
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thank you. I'll have to wait and see if this script works before I can say what you've said is working for me. But for now I'll post a screen shot and if you could check everything is correct, it would be very much appreciated.

    Screen shot:

    http://img294.imageshack.us/img294/49/cpanelwhmphio1.png
     
  5. trhosting.net

    trhosting.net Well-Known Member

    Joined:
    Mar 7, 2006
    Messages:
    151
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Turkey
    You made it wrong

    Type * in the first field (you typed IN)
     
  6. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Trhosting.net gave you the instructions for manually editing the zone files ...

    If you are using the DNS editor, then you won't see the word "IN" anywhere.

    1. In that last line, you need to change "IN" to "*" ...

    2. Restart your DNS server (BIND) ...

    3. You need to edit the httpd.conf and add a ServerAlias to the virtual host
    that will be handling the wildcard domains as "*.domain.com" where
    domain.com is your domain name. If you are not technically inclined
    and sounds like you aren't, you could possibly do this by parking a
    wildcard (*) domain to that account.

    4. Restart your web server

    I am surprised you would allow a "free hosting client" to setup a short url redirect
    service from your servers (what you said in your first post) because that is probably
    going to seriously such the network connections, DNS queries, and possibly a
    fair bit of bandwidth --- not something I'd think you would want them to do
    unless they are actually paying you for it.

    --AMZ
     
    #6 Spiral, Dec 26, 2006
    Last edited: Dec 26, 2006
  7. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    Does anyone think the ability to create wildcard dns should be put forward as a feature request?
     
  8. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Why? It's just a simple matter of adding wildcard to the DNS and HTTPD.CONF!

    In fact, you can even have accounts use wilcards automatically already!

    Just update the DNS zone templates in WHM and add the wildcard put the required
    extra "ServerAlias" in httpd templates (/usr/local/cpanel/etc/httptemplates)
     
  9. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Apparently you failed to read my last post since the part you didn't quote
    tells you exactly how to do it from WHM directly! ;)
     
  10. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    ...because its defeats the whole point of a user-friendly cPanel? Hey, lets just do away with WHM altogether since everything can be done via SSH instead!

    Actually, I was really just asking if this might be a useful/common requirement for web hosts, in which case it would be good to have it as an automated feature (especially for the server admin newbies).
     
    #10 adept2003, Dec 26, 2006
    Last edited: Dec 26, 2006
  11. hbidad

    hbidad Well-Known Member

    Joined:
    Apr 16, 2005
    Messages:
    74
    Likes Received:
    1
    Trophy Points:
    8
    Code:
    # nano /usr/local/apache/conf/httpd.conf
    add this to the Domain virtual host entry:

    Code:
    ServerAlias *.domain.com
    (replace domain.com with the actual domain)


    Then:

    Code:
    # nano /var/named/domain.com.db
    (replace domain.com with the actual domain)

    add the following line to the bottom if the file:

    Code:
    *       14400   IN      A       XXX.XXX.XXX.XXX
    Replace XXX.XXX.XXX.XXX with the IP of the domain (e.g. 192.168.0.1)

    Then:

    Code:
    # service named restart
    lastly:

    Code:
    # service httpd restart
    Enjoy
     
Loading...

Share This Page