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.

DNS wildcard for all sites

Discussion in 'Bind / DNS / Nameserver Issues' started by comeran, Nov 25, 2008.

  1. comeran

    comeran Member

    Joined:
    Nov 25, 2008
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hello all!

    I have been trying to figure this out for hours and it is killing me! Any help would be greatly appreciated.

    I am using centOS with cpanel 11/whm and x3.

    The first domain we setup on the box was a clients website, and now it seems to be the default somewhere and we need that changed. Here are the symptoms:


    www.customersite.com = first site we ever setup

    now on all new domains if someone uses a non-existent subdomain the first site comes up! So:

    notreal.newsite.com goes to www.customersite.com!

    This means that if anyone tries mail.theirdomain.com (since we don't use that) it goes to the first clients website!

    How can we change that so it either just goes to the original homepage of that domain, or to an error page on our hosting site so at least people don't call saying that the first client has hijacked their site :p

    Also if you go to http://serverIP it loads that first website.

    Thanks in advance!

    Com-
     
    #1 comeran, Nov 25, 2008
    Last edited: Nov 25, 2008
  2. Anandpatilg

    Anandpatilg Registered

    Joined:
    Mar 20, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    this is happening due to the vhost entry of the first domain setup. the vhost entry of that domain occurs first in httpd.conf due to which it is considered as default domain. if you access your server ip in browser like:

    For eg: server Ip is 45.12.25.74

    http://45.12.25.74

    you will see the site content. All you have to do is as follows:

    pico /etc/httpd/conf/httpd.conf

    find the first virtual host entry and add following virtual host entry just above it:

    NameVirtualHost SERVER IP:80

    <VirtualHost SERVER IP>
    ServerName HOSTNAME
    DocumentRoot /usr/local/apache/htdocs
    </VirtualHost>

    Once the above entry is made first virtual host entry in httpd.conf, save the changes and restart service httpd and you are done

    Thanks.
    MSN: shellscripters@hotmail.com
     
  3. comeran

    comeran Member

    Joined:
    Nov 25, 2008
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Thanks! The only problem is that the httpd.conf file says not to edit it as it is edited by cpanel!

    Is there a way to edit this in cpanel? Or is there a way to edit httpd.conf it and not break cpanel?
     
  4. apscinsspl

    apscinsspl Well-Known Member

    Joined:
    Mar 15, 2008
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    16
    Hello,

    You can ignore that message, we can edit the httpd.conf file using any editor from the server. Just see that you add the entry just above the first virtual host entry present.
     
  5. 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
    Try this.

    /usr/local/cpanel/bin/build_apache_conf

    It recreates httpd.conf from cPanel userdata files and usually removes any misconfigurations etc, restart apache service and check if the problem continues.
     
  6. comeran

    comeran Member

    Joined:
    Nov 25, 2008
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Thanks! The thing is that I need to edit the order of the httpd.conf file, and if I manually do it then any time cpanel needs to recreate the file the new order will be lost!

    I will manually do it for now, but is there a way to edit the order of the vhosts or edit the httpd.conf file with cpanel ?
     
  7. formula13x

    formula13x Member

    Joined:
    Nov 25, 2008
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I applied the suggested changes to the
    /usr/local/apache/conf/includes/pre_virtualhost_global.conf
    file and restarted my apache serice and all is well.

    I suppose this file is so that if the httpd.conf gets rebuild, your changes might remain.

    _____

    Edit /usr/local/apache/conf/includes/pre_virtualhost_global.conf

    and specify something like this.



    NameVirtualHost SERVERIPTOUSE:80

    <VirtualHost SERVERIPTOUSE>
    ServerName SERVERNAMETOUSE
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin EMAILTOUSE
    </VirtualHost>





    Then restart the apache service
    Main >> Restart Services >> HTTP Server (Apache)
     
Loading...

Share This Page