本文共 613 字,大约阅读时间需要 2 分钟。
通过限制referer来实现防盗链的功能
配置文件增加如下内容:vim /usr/local/apache2.4/conf/extra/httpd-vhosts.confSetEnvIfNoCase Referer "http://111.com" local_ref //定义白名单 SetEnvIfNoCase Referer "http://aaa.com" local_ref SetEnvIfNoCase Referer "^$" local_ref //定义规则 Order Allow,Deny //定义顺序,允许或者拒绝 Allow from env=local_ref
浏览器访问显示:
curl -e "" 自定义referer
curl -e "http://www.qq.com/123.html" -x127.0.0.1:80 111.com/qq.png -I
curl -e "http://aaa.com/123.txt" -x127.0.0.1:80 111.com/qq.png -I
正常
转载于:https://blog.51cto.com/14079728/2347121