防盗链实战一例

技术学习/linux学习 2007/05/21 17:50
  最开始为了减少网站的流量,对下载服务器作了防盗链控制,用了SetEnvIf来做的
   SetEnvIfNoCase Referer "^^http://.*\.eol\.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://www\.edu.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://free\.eol\.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://.*\.media.edu.cn/.*" local_ref=1
      <FilesMatch "\.(mp3|rm|zip|rar|iso|mpg|pdf)">
      Order Allow,Deny
      Allow from env=local_ref 
   </FilesMatch>
但是有人反映bbs.eol.cn上的一些帖子上的mp3不能直接播放,我打开页面看到确实是这样的。
查看日志发现bbs.eol.cn来的请求就是403错误。肯定是防盗链没做好。
在网上找来找去,说的方法都是一样的,所以就一时没了门。
后来按同事给我的防止flashget下载的一个帖子那里得到启发,对browser做控制。

   BrowserMatch "RealPlayer" local_media=0
   BrowserMatch "MediaPlayer" local_media=0
   Allow from env=local_media

但是还是不行,老觉得local_media应该是1,改过来,还是不行。
我就存下院文件看看,发现<object中id是NSPlayer,就想着是不是这里不对
就又加一条   BrowserMatch "NsPlayer" local_media=1

还是不行,后来配合日志发现大小写不一致,于是改成
  BrowserMatch "NSPlayer" local_media=1
形成下边的策略,问题搞定!呵呵:>不容易!


  SetEnvIfNoCase Referer "^http://(.)+\.eol\.cn/" local_ref=1
  # SetEnvIfNoCase Referer "^http://*.eol.cn/" local_ref=1
   SetEnvIfNoCase Referer "^http://bbs\.eol\.cn/" local_ref=1
   SetEnvIfNoCase Referer "^http://www\.edu.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://free\.eol\.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://.*\.media.edu.cn/.*" local_ref=1
   SetEnvIfNoCase Referer "^http://219\.224\.99\.254/" local_ref=1
   BrowserMatch "RealPlayer" local_media=1
   BrowserMatch "MediaPlayer" local_media=1
   BrowserMatch "NSPlayer" local_media=1
   <FilesMatch "\.(mp3|rm|zip|rar|iso|mpg|pdf)">
      Order Allow,Deny
      Allow from env=local_ref
      Allow from env=local_media
   </FilesMatch>

top

Trackback Address :: http://blog.ligj.eol.cn/trackback/478

  1. dfaf 2008/08/07 18:08 MODIFY/DELETE REPLY

    不能做到防盗MP3的

  2. North Face Apex Jacket 2012/01/09 10:44 MODIFY/DELETE REPLY

    This is some great thing never thought of it like that.

  3. Mens Designer Clothing 2012/01/10 15:32 MODIFY/DELETE REPLY

    Mens Designer Jeans

  4. Coach Outlet online 2012/02/04 10:33 MODIFY/DELETE REPLY

    Coach Outlet online

  5. Ed Hardy Swimwear 2012/02/27 14:28 MODIFY/DELETE REPLY

    In today's world, nothing without a christian louboutin on sale package has the ability to sell including an eraser

  6. golf equipment 2012/04/13 14:41 MODIFY/DELETE REPLY

    http://www.t8lv.com/LV outlet
    http://www.officialpradaoutlets.com/prada shoes
    http://www.paulsmith-outlet.org/Paul Smith Handbag
    http://www.clubs-golf.net/golf store
    http://www.2012mulberrybags.org/Mulberry handbags Outlet
    http://www.voguechaneloutlet.com/Chanel Outlet
    http://mulberryoutlet.de/mulberry taschen
    http://www.goyard-bag.com/goyard tote
    http://www.thechloee.com/Chloe handBags Store
    http://www.ferragamo-salvatore.net/ferragamo shoes
    http://www.toryburch-outletshop.net/tory burch sale
    http://www.2012mulberryhandbags.org/mulberry bayswater
    ardwe485 4.13

  7. Rings Size 2012/04/23 10:48 MODIFY/DELETE REPLY

    It again is close to 3 or 4 many weeks, or possibly till the time this task multiplies out.

  8. Tiffany Rings 2012/04/23 10:48 MODIFY/DELETE REPLY

    ndoubtedly, the easiest strategy for styling head of hair is to blow-dry the situation every day whenever you clean up tiffany Sets.

  9. Tiffany Cross necklace 2012/04/23 10:48 MODIFY/DELETE REPLY

    You can be somewhat specific mother and father often survive within the afternoon.

  10. ghd glamour 2012/04/23 10:49 MODIFY/DELETE REPLY

    Any Sedu hair straighteners can be very widely used immediately; suggested plus used by lots of the famous people.

  11. replica handbags 2012/04/23 10:49 MODIFY/DELETE REPLY

    This particular flat iron flat iron quite successfully smoothens heaps of different frizzy hair, even if your actual locks are bad, fluorescent and also untamed.

Write a comment