发新话题
打印

lighttpd+mod_secdownload的 防盗链 配置

lighttpd+mod_secdownload的 防盗链 配置

一. 编辑lighttpd.conf
server.modules = (

“mod_secdownload”,
“mod_flv_streaming”,
“mod_h264_streaming”,

)
# mod_secdownload必须放在上面,不然拖动无效.即?start=无效
# 可以手工wget http://blog.zhangjianfeng.com/path/filename.mp4?start=100/1000等测试

flv-streaming.extensions = ( “.flv” )
h264-streaming.extensions = ( “.mp4″ )
secdownload.secret = “blog.zhangjianfeng.com”
secdownload.document-root = “/blog.zhangjianfeng.com/data/videos/”
#待加密文件存放的位置,跟DocumentRoot路径值无关
secdownload.uri-prefix = “/dl/”
#加密地址串前缀,跟实现文件路径无关
secdownload.timeout = 120
#加密URL的过期时间,单位是秒

二. 生成加密URL的脚本
\<\?
$secret = “verysecret”;
$uri_prefix = “/dl/”;
# filename
$f = “/trailer2.mp4″;
# current timestamp
$t = time();
$t_hex = sprintf(”%08x”, $t);
$m = md5($secret.$f.$t_hex);
# generate link
printf(’%s’,
$uri_prefix, $m, $t_hex, $f, $f);
?>

来自:http://blog.zhangjianfeng.com/article/1006
换个头像,看见广告就眼红,直接封ID。

TOP

发新话题