Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    4

    Default DNS wildcard for all sites

    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

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

    Thanks in advance!

    Com-
    Last edited by comeran; 11-25-2008 at 08:32 PM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    1

    Default

    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. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    4

    Default

    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. #4
    Member apscinsspl's Avatar
    Join Date
    Mar 2008
    Posts
    112

    Default

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

    Default

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

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

    Thanks in advance!

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

  6. #6
    Registered User
    Join Date
    Nov 2008
    Posts
    4

    Default

    Quote Originally Posted by JPC-Howard View Post
    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.
    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. #7
    Member
    Join Date
    Nov 2008
    Posts
    9

    Default

    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)

Similar Threads & Tags
Similar threads

  1. Apache won't restart after installing wildcard SSL in WHM - PROBLEM sites offline
    By Niels Leenders in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-14-2011, 12:32 PM
  2. httpd.conf sites/www.domain.com.conf Wildcard DNS
    By ttremain in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 12-16-2008, 11:19 AM
  3. DNS Wildcard?
    By Millar in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 02-21-2008, 04:05 PM
  4. Wildcard DNS ?
    By lgabi in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 11-05-2007, 10:04 PM
  5. Hosted Sites unable top lookup(DNS) other sites
    By bomonguny in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-05-2006, 05:09 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube