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.

Wildcard DNS

Discussion in 'Bind / DNS / Nameserver Issues' started by Roberto, Apr 15, 2004.

  1. Roberto

    Roberto Active Member

    Joined:
    Jul 9, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    I have this in httpd.conf:

    #ServerAlias www.hiphoprappers.com hiphoprappers.com
    ServerAdmin webmaster@hiphoprappers.com
    DocumentRoot /home/hhr/public_html
    BytesLog domlogs/hiphoprappers.com-bytes_log
    ServerAlias *.hiphoprappers.com hiphoprappers.com
    ServerName www.hiphoprappers.com
    User hhr
    Group hhr
    CustomLog domlogs/hiphoprappers.com combined
    #RedirectMatch 301 (.*) http://hiphoprappers.com$1
    ScriptAlias /cgi-bin/ /home/hhr/public_html/cgi-bin/

    and this in hiphoprappers.com.db in the named folder:

    ; Modified by Web Host Manager
    ; Zone File for hiphoprappers.com
    @ 14400 IN SOA ns1.wisd0m.net. root.server1.wisd0m.net. (
    2004041524
    28800
    7200
    3600000
    86400
    )

    hiphoprappers.com. 14400 IN NS ns1.wisd0m.net.
    hiphoprappers.com. 14400 IN NS ns2.wisd0m.net.
    hiphoprappers.com. 14400 IN A 216.12.200.18

    localhost.hiphoprappers.com. 14400 IN A 127.0.0.1

    hiphoprappers.com. 14400 IN MX 0 hiphoprappers.com.

    mail 14400 IN CNAME hiphoprappers.com.
    www 14400 IN CNAME hiphoprappers.com.
    ftp 14400 IN A 216.12.200.18
    www2 14400 IN A 216.12.200.18
    www.www2 14400 IN A 216.12.200.18
    studio 14400 IN A 216.12.200.18
    www.studio 14400 IN A 216.12.200.18
    test 14400 IN A 216.12.200.18
    www.test 14400 IN A 216.12.200.18
    *.hiphoprappers.com. 14400 IN A 216.12.200.18


    I used this guide:

    http://photomatt.net/archives/2003/10/10/wildcard-dns-and-sub-domains/

    And it is not working. All newly created valid subdomains still get redirected by the wildcard line in httpd.conf. Any ideas?

    Thanks!
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    What do you mean by, "it is not working". What you've configured will do exactly what you've said it does. The wildcard DNS directs *.yourdomain.com to your server. The ServerAlias of *.yourdomain.com will make Apache grab any URL starting *.yourdomain.com and match it to the DocumentRoot for www.yourdomain.com. What did you expect to happen?
     
  3. phpman

    phpman Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Rio de Janeiro - Brazil
    Hello

    Edit /scripts/wwwacct

    --x---x---x---x---x---x---x

    pico -w /scripts/wwwacct

    search for '14400'

    see:

    $domain. 14400 IN MX 0 $domain.

    mail 14400 IN CNAME ${domain}.
    www 14400 IN CNAME ${domain}.

    substitute for:

    $domain. 14400 IN MX 0 $domain.

    mail 14400 IN CNAME ${domain}.
    www 14400 IN CNAME ${domain}.
    * 14400 IN A $nip


    and search '<VirtualHost $ip>'

    see:

    <VirtualHost $ip>
    ServerAlias www.$domain $domain
    ServerAdmin webmaster\@$domain
    DocumentRoot $mnt/$user/public_html
    ServerName www.$domain


    substitute for:

    <VirtualHost $ip>
    ServerAlias *.$domain $domain
    ServerAdmin webmaster\@$domain
    DocumentRoot $mnt/$user/public_html
    ServerName www.$domain


    Important: The change done in <VirtualHost $ip> IS NOT IMPORTANT, SCRIPT WORKS PERFECTLY WITHOUT HER.


    Save and protect:

    ctrl + o
    ctrl + x
    chattr +i /scripts/wwwacct

    Huggs
     
    #3 phpman, Apr 16, 2004
    Last edited: Apr 16, 2004
  4. Roberto

    Roberto Active Member

    Joined:
    Jul 9, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the advice!

    My problem is all subdomains point to the main domain, but when I want to create a valid subdomain such as "test.hiphoprappers.com" it is still caught by the wildcard dns....

    Any ideas?
     
  5. phpman

    phpman Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Rio de Janeiro - Brazil
    Yesterday the night I configured that for my customer.

    See: www.svclub.com.br

    Create a subdomain and see how it works:

    To be necessary of help uses the msn: support01@brnoc.com

    Hug
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Roberto,

    try editing your httpd.conf file and placing your "static" subdomain test.hiphoprappers.com VirtualHost container before your wildard ServerAlias VirtualHost container and then reload Apache. In theory, Apache should then match on the configured subdomain before hitting the main domains ServerAlias.
     
  7. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Wildcard Virtual-Host entry is not required for wildcard dns to function. We have this setup for a few sites and do not use any entry in httpd for the wildcard. You're just creating an admistration nightmare for yourself, as anytime an entry is added to httpd.conf you'll need to manually move it ahead of the wildcard as stated earlier.
     
  8. phpman

    phpman Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Rio de Janeiro - Brazil
    Important: The change done in <VirtualHost $ip> IS NOT IMPORTANT, SCRIPT WORKS PERFECTLY WITHOUT HER.


    :)
     
  9. Roberto

    Roberto Active Member

    Joined:
    Jul 9, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    No, I did not change that. It still is not working. I have a subdomain, studio.hiphoprappers.com and it shoudl forward to hiphoprappers.com/studio but this is not working because it gets forwarded to hiphoprappers.com liek any other non-existant subdomain.
     
    #9 Roberto, Apr 16, 2004
    Last edited: Apr 16, 2004
  10. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    Better don't do that or you'll possibly have all kinds of problems. If you want to edit the DNS zone that wwwacct creates I suggest editing the DNS zone templates from WHM.
     
  11. Vircon

    Vircon Registered

    Joined:
    Mar 22, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi dgbaker,

    Can you please tell us how you've set this up without the "httpd.conf" change (it is indeed an admistration nightmare :mad: ).

    Regards,
    Robert
     
  12. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar

    dgbaker, please tell me how to do it because i need your solution too
     
  13. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    It depends on what you are trying to achieve. If you trying to get anything@domain.com to go to your site then the httpd.conf change is required. If though you are doing it so that newly created sub-domains resolve faster then all you need is the DNS wildcard.
     
  14. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    Say, if i need this wildcard dns thing for my url redirection script so i can use it for anything.domain.com to redirect to anotherserver.com

    How about that ? Can i have wildcard dns without editing the httpd.conf ?
     
  15. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Not that I know of. One trick to try is to add the *.domain.com to the ServerAlias line of the virtualhost entry you want them directed to. (I have not tried that yet though).
     
  16. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    yes dgbaker, i already use *.domain.com to the ServerAlias line of the virtualhost entry at httpd.conf for a week now and works.

    but if you have any option to do the wildcard thing without editing httpd.conf :D but i think impossible isn't it
     
  17. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Yep, it's quite simple as well, if you have a non-existant name such as mine.domain.com, and you want it to direct to a site, apache needs to know how to handle it. Without a VH for mine.domain.com or a wildcard entry Apache does not know how to handle.
     
Loading...

Share This Page