2007
01.31

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

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

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

5 comments so far

Add Your Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word