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

  用过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

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
10 Responses
  1. Steven.Dai says:

    Michael您好,打扰了.发您邮件可能跑垃圾邮件里去了,等了几天没见您回复.所以留言到您这里来了.:)
    故事是这样的:
    我是做点播服务的,说的通俗点就是像现在的电影网站,影片数据是放在自己的服务器上的.现在的情况是这样,眼看影片数据的一天一天增加,硬盘的容量也一点一点减少.该怎么规划新的存储结构噢?
    小弟才浅,1\认为在原来的做过Raid1上面在加两个相同容量的硬盘上去.
    2\在增加一台烂机器,采用现在的小弟认为比较热门的FreeNAS来做,存储服务器?(对FreeNas我不是很懂)
    请问michael指点指点?小弟不胜感激.(方案最好成本越低越好,因为现在访问量并不大)

  2. Michael says:

    的确没有收到邮件,如果你的邮件标题大多是英文的,估计都会被我的postfix邮件系统自动扔到垃圾箱了:)

    你说的情况不是很明确,首先你有没有分布式? 还是只是单机? 另外你提供的服务是直接在线播放吗?

    基于上述问题,你可能需要考虑如何保证不同电信运营商接入用户的速度问题,如果分布式的话要考虑同步问题。

    存储空间始终都是在不断增长的,如果说你想让自己的业务不断蒸蒸日上,那就必须面临存储的不断膨胀。

    我接触过的情况是大部分都是存储上10T级别的,这样的应用都需要用到专门的盘阵,有一些专门的公司做这个,有他们的服务很好,盘阵有基于光纤的也有磁盘柜的,我建议你一开始就选择一个盘阵比较好,盘阵都是可扩展的,随着业务增长只需要往上堆硬盘就行。

    如果你想低成本先用普通机器顶着,你就往机器上加硬盘即可,然后进行分区mount到系统上,如果不想改太多程序,做个符号连接到原来的存储目录里面即可。

    另外,也可以考虑新增加一台机器,使用NFS挂接到现有机器上。

    有更多问题,如果我知道的会尽力回复你,邮件lee@toplee.com

  3. Steven.Dai says:

    Michael谢谢您的细心回答.:)

  4. 很久没来了,又更新了.

  5. 阿超 says:

    博主你好 我一直在网上找一些防止盗连的技术或者软件 看见了你的文章
    像看见了希望一样 我的网站上视频放在一个服务器上 页面放在一个服务器上
    应该如何处理盗连呢 我的服务器都是windows的 麻烦帮我想想办法可以么
    我在http://v.nmtv.cn/ 这个网站上 看见类似我想要的 他的视频文件都是wmv格式和我的一样 他的是写了什么程序处理了 应该这个程序怎么实现 没点思路 望指教

  6. monface says:

    lighttpd.conf配置文件的路径是那个哦?

  7. monface says:

    我vps的,路径如下
    /etc/lighttpd/lighttpd.conf
    /usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/lighttpd.conf
    /usr/local/lxlabs/kloxo/file/lighttpd.conf
    /usr/local/lxlabs/kloxo/file/lighttpd/lighttpd.conf
    /usr/share/doc/lighttpd-1.4.20/lighttpd.conf 具体都不晓得应该是那个了

  8. Michael says:

    monface: 我vps的,路径如下
    /etc/lighttpd/lighttpd.conf
    /usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/lighttpd.conf
    /usr/local/lxlabs/kloxo/file/lighttpd.conf
    /usr/local/lxlabs/kloxo/file/lighttpd/lighttpd.conf
    /usr/share/doc/lighttpd-1.4.20/lighttpd.conf 具体都不晓得应该是那个了

    应该是 /etc/lighttpd/lighttpd.conf

  9. 小飞 says:

    这个是vi /etc/lighttpd/lighttpd.conf 吗?
    菜鸟不懂,有没有详细点的说明?

  10. Ugg Sale UK says:

    There are some most important information in your article. If you have any more better articles, welcome to share with us.

  11. What’s up, after reading this amazing post i am
    too cheerful to share my experience here with colleagues.

  12. minecraft says:

    This post is actually a fastidious one it helps new the web people,
    who are wishing in favor of blogging.

  13. minecraft says:

    Link exchange is nothing else except it is simply placing the other person’s webpage
    link on your page at proper place and other person will also do
    same for you.

  14. minecraft says:

    I have been exploring for a little for any high quality articles or
    blog posts on this sort of area . Exploring in Yahoo I ultimately stumbled upon this site.

    Reading this information So i’m glad to convey that I’ve a very excellent uncanny feeling I found out just what I needed.

    I most definitely will make certain to do not put out of your
    mind this web site and provides it a look on a relentless basis.

  15. minecraft says:

    It’s difficult to find knowledgeable people about this topic, but you sound like you know what you’re talking about!
    Thanks

  16. minecraft says:

    Thank you for another wonderful article. Where else may
    anybody get that kind of info in such a perfect method of
    writing? I have a presentation subsequent week, and I am on the look for such information.

  17. Hi, Neat post. There is a problem along with your site in internet explorer, could check
    this? IE nonetheless is the marketplace chief and a big
    element of people will leave out your fantastic writing due to this problem.

  18. I believe that is one of the so much important information for me.
    And i am happy reading your article. But want to observation on few general things, The web site taste is perfect, the
    articles is in point of fact excellent : D. Excellent job, cheers

  19. Hello there, just became alert to your blog through Google,
    and found that it’s truly informative. I am going to watch out for brussels.
    I’ll appreciate if you continue this in future. A lot of people will
    be benefited from your writing. Cheers!

  20. What’s up friends, its fantastic post on the topic of cultureand completely
    explained, keep it up all the time.

  21. Greetings! I know this is somewhat off topic but
    I was wondering which blog platform are you using for this website?

    I’m getting sick and tired of WordPress because I’ve had issues
    with hackers and I’m looking at alternatives for another platform.
    I would be fantastic if you could point me in the direction of a good
    platform.

  22. Coconut Oil says:

    Hi i am kavin, its my first occasion to commenting anyplace, when i read this
    post i thought i could also create comment due to this brilliant piece
    of writing.

  23. Hello there I am so grateful I found your site, I really found
    you by mistake, while I was looking on Google for something else, Anyhow
    I am here now and would just like to say thank
    you for a remarkable post and a all round interesting
    blog (I also love the theme/design), I don’t have time to read through it all at the moment but
    I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep
    up the awesome jo.

  24. Coconut Oil says:

    What’s up to all, the contents existing at this web site are in fact awesome for people knowledge, well,
    keep up the good work fellows.

  25. If some one wishes to be updated with latest technologies after that he must be go to see this web site and be up to date
    daily.

  26. Hello there! I just would like to give you a big thumbs up for
    your excellent info you have got right here on this post. I am
    returning to your web site for more soon.

  27. I was extremely pleased to uncover this page.

    I want to to thank you for ones time due to this wonderful read!!
    I definitely savored every little bit of it and i also have you bookmarked to look at new
    information on your site.

  28. quest bars says:

    I do not even know how I finished up here, however I
    thought this submit was good. I do not know who you’re however definitely you are going to a well-known blogger if you aren’t already.
    Cheers!

  29. Quest Bars says:

    It’s really very complex in this busy life to listen news on Television, thus
    I just use the web for that reason, and get the most recent information.

  30. Remarkable! Its in fact awesome post, I have
    got much clear idea on the topic of from this
    post.

  31. Sling TV says:

    What you published made a ton of sense. But, consider this, what if you were to write
    a awesome headline? I ain’t suggesting your content isn’t solid., but suppose you added a headline that grabbed people’s attention? I mean Lighttpd 图片和视频等文件的防盗链处理 | 李俊麟的平凡生活 is a
    little plain. You could peek at Yahoo’s home page and note how
    they create news headlines to get people to click. You might add a related
    video or a related pic or two to grab readers excited about
    everything’ve got to say. Just my opinion, it could
    bring your posts a little livelier.

  32. Sling TV says:

    I got this web site from my pal who shared with me concerning this web site and now this time I am
    visiting this web site and reading very informative articles here.

  33. Sling TV says:

    This paragraph will assist the internet users for creating new blog or even a blog from start to end.

  34. What’s up, always i used to check website posts here in the early hours in the daylight, since i like to gain knowledge of more and more.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
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.
Anti-spam image