Tag-Archive for » 防盗链 «

Lighttpd 图片和视频等文件的防盗链处理

  用过Apache的朋友都知道mod_rewrite可以用来进行处理防盗链,Lighttpd也有同样的功能,而且总的来说,lighttpd.conf配置文件比httpd.conf更简单明了。 原来一直使用Apache来处理防盗链,今天修改了服务器上Lighttpd的配置,直接实现了防盗链,下面是防盗链部分的代码。

[coolcode]
$HTTP[“referer”] !~ “^($|http://.*\.(toplee\.com|8zone\.cn))” {
  $HTTP[“url”] =~ “\.(jpg|jpeg|png|gif|rar|zip|mp3)$” {
    url.redirect = (“.*” => “http://www.toplee.com/blog/”)
  }
}
[/coolcode]

  懂点编程的朋友一定惊叹lighttpd的配置如此简洁明了,我非常喜欢这种风格的东西!
Lighttpd