防止第三方站点盗用自己站点的资源
1.配置虚拟主机文件 #vim /usr/local/apache/conf/extra/httpd-vhosts.conf
SetEnvIfNoCase Referer "^http://.*\.zhijie\.com(白名单域名)" local_ref
SetEnvIfNoCase Referer ".*\.maozhijie\.com(白名单域名)" local_ref
SetEnvIfNoCase Referer "^$" local_ref
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif|jpeg)(防盗文件类型)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
2.重启Apache
(1)#/usr/local/apache/bin/apachectl -t
(2)#/usr/local/apache/bin/apachectl restart
时间: 2024-10-05 04:19:25