我在带有LAMP堆栈的centos 5.10上有一个运行VPS的Apache。
我在此框中有多个域,它们通过VirtualHost路由到.conf
文件中。
当我进入浏览器并输入虚假的子域时,例如aa.mynewco.com
我得到一个页面,上面写着Your connection is not private
,即使我在该服务器名上没有设置和子域,它也可以继续进行。当我继续时,它将带我到companyname.com
。
但是当我在aa.companyname.com
上尝试相同的伪造子域时
我得到This site can’t be reached
如何防止伪造的子域?为什么mynewco.com
进行到companyname.com
?
ServerName localhost
<VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName www.dev.companyname.com
ServerAlias dev.companyname.com
ServerAdmin abc@yahoo.com
DocumentRoot "/var/www/html/dev.companyname"
<Directory /var/www/html/dev.companyname>
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName www.companyname.com
ServerAlias companyname.com
ServerAdmin abc@yahoo.com
DocumentRoot "/var/www/html/companyname"
<Directory /var/www/html/companyname >
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
DirectoryIndex index.html index.php
ServerAdmin abc@yahoo.com
DocumentRoot /var/www/html/companyname
ServerName www.companyname.com
ErrorLog /var/log/conf.log
SSLEngine on
SSLProtocol all
SSLCertificateFile /etc/pki/tls/certs/companyname_public.crt
SSLCertificateKeyFile /etc/pki/tls/certs/companyname_private.key
SSLCertificateChainFile /etc/pki/tls/certs/companyname_intermediate.crt
<Directory "/var/www/html/companyname">
Options FollowSymLinks
</Directory>
</VirtualHost>
<VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName www.mynewco.com
ServerAlias mynewco.com
ServerAdmin abc@yahoo.com
DocumentRoot "/var/www/html/mynewco"
<Directory /var/www/html/mynewco >
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
DirectoryIndex index.html index.php
ServerAdmin abc@yahoo.com
DocumentRoot /var/www/html/mynewco
ServerName www.mynewco.com
ErrorLog /var/log/conf.log
SSLEngine on
SSLProtocol all
SSLCertificateFile /etc/pki/tls/certs/mynewco_public.crt
SSLCertificateKeyFile /etc/pki/tls/certs/mynewco_private.key
SSLCertificateChainFile /etc/pki/tls/certs/mynewco_intermediate.crt
<Directory "/var/www/html/mynewco">
Options FollowSymLinks
</Directory>
</VirtualHost>