如何设置防盗链,防止别人盗用图片和视频,应该如何做?
1.打开虚拟主机配置文件
vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
增加内容
SetEnvIfNoCase Referer "^http://.*.test.com" local_ref
SetEnvIfNoCase Referer ".*.lizheng.com" local_ref
<filesmatch ".(txt|doc|mp3|zip|rar|jpg|gif|css)">
Order Allow,Deny
Allow from env=local_ref
Deny from all
</filesmatch>
650) this.width=650;" src="/upload/getfiles/default/2022/11/9/20221109094355873.jpg" />
2.重启并加载
apachectl -t
apachectl graceful
3.刷新页面
650) this.width=650;" src="/upload/getfiles/default/2022/11/9/20221109094355873.jpg" />
4.要使自己能查看图片,把自己的域名放在白名单里
650) this.width=650;" src="/upload/getfiles/default/2022/11/9/20221109094355873.jpg" />
刷新网页可以正常显示
650) this.width=650;" src="/upload/getfiles/default/2022/11/9/20221109094355873.jpg" />
原文:http://11937277.blog.51cto.com/11927277/1879815
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!