Apache禁止域名恶意指向网站的方法

(编辑:jimmy 日期: 2024/9/23 浏览:2)

安装apache 后默认网站是可以通过ip访问的,所以可能会有些恶意的域名指向你的网站。

遇到这种情可以建一个默认的站点 (注意,要保证这个的站点在所有站点的最前面,可以通过ip直接访问此站)

<VirtualHost *:80> 
ServerAdmin webmaster@localhost 
DocumentRoot /var/www 
<Directory /> 
Options Indexes FollowSymLinks MultiViews 
AllowOverride None 
Order deny, 
deny from all #直接屏蔽所有人访问 
</Directory> 
ErrorLog ${APACHE_LOG_DIR}/error.log 
LogLevel warn 
CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>