Do not return sites for domain that is not listed

s2s

Member
Nov 21, 2013
20
1
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
 

s2s

Member
Nov 21, 2013
20
1
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.)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
I am happy to see you were able to resolve the issue. Thank you for updating us with the outcome.