lighttpd防盗链规则

2020年03月31日

原创内容,转载请注明出处:https://www.myzhenai.com.cn/post/3203.html

这个方法是在hostloc社区的圈圈和404两位朋友指导的,很多年前我使用lighttpd的时候遇到的问题,现在做个记录以便以后查找。

图片之类的资源可以用referer防盗
https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Configuration
如果referer不为空或者https://www.example.org/XXXXX, jpg/png就禁止访问


 # deny access for all image stealers (anti-hotlinking for images)
  $HTTP["referer"] !~ "^($|https://www\.example\.org)" {
    url.access-deny = ( ".jpg", ".jpeg", ".png" )
  }

 

如果是视频,下载之类需要防软件的
https://redmine.lighttpd.net/projects/1/wiki/Docs_ModSecDownload

以下是我自己改的规则

$HTTP["referer"] !~ "^($|https://.*\.(example\.com|example\.com|example\.com.cn|example\.com))" {
    url.access-deny = ( ".jpg",".jpeg",".png",".gif",".zip",".rar",".mp3",".mp4",".wmv",".mp2",".wma",".flv")
}

 


sicnature ---------------------------------------------------------------------
Your current IP address is: 3.81.221.121
Your IP address location: 美国弗吉尼亚阿什本
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://www.myzhenai.com.cn/post/3203.html

没有评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注