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.

Do not return sites for domain that is not listed

Discussion in 'General Discussion' started by s2s, Mar 20, 2014.

  1. s2s

    s2s Member

    Joined:
    Nov 21, 2013
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    How do I correctly configure the server to not return any site for domains that are not explicitly listed in httpd.conf?

    At the minute our VPS returns one of our hosted packages for all sites, even if the domain is not listed in httpd.conf! This means any domain that points to our VPS IP gets served with one of our hosting packages - meaning Google is displaying the content of that hosting site under different domain names in SERP.

    I would like to:

    a) only return websites for domains that are explicitly defined in httpd.conf (do nothing for unconfigured domains pointed to our IP)

    b) configure the page/site displayed when visiting the VPS shared IP
     
  2. s2s

    s2s Member

    Joined:
    Nov 21, 2013
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I resolved this issue by adding the following code to the cPanel vhosts template (at the top):

    /var/cpanel/templates/apache2/vhost.local
    Code:
    <VirtualHost [% FOREACH ipblock IN vhost.ips %] [% ipblock.ip %][% END %]:8080>
       ServerName default-unauth-domain
       <Location />
         Order deny,allow
         Allow from googlebot.com
         Allow from 127.0.0.1
       </Location>
    </VirtualHost>
    This forces apache to deny requests to any domain name other than the name identified in the preceeding vhost config. It also adds the 'patch' into the cPanel template so that it get included each time apache config gets rebuilt (updates, etc.)
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page