请问NGINX防盗连
小弟目前按照教学写藉由PHP范例可以生成这样加密网址 media/000.mp4?s=IPoNJiowv3fk59UgOQeUeA&e=1506890816(NGINX.CONF)
location ~ \.mp4$ {
rewrite ^(.*)/(.*)/(.*)/media/(.+)\.mp4$ $1/media/$4.mp4?s=$2&e=$3 last;
secure_link $arg_s,$arg_e;
secure_link_md5 test$uri$arg_e;
if ($secure_link = "") {
return 403;
}
if ($secure_link = "0") {
return 403;
}
mp4;
mp4_buffer_size 5m;
mp4_max_buffer_size 50m;
}
(PHP)
$cdn = "http://www.test.com";
$path = "/media/000.mp4";
$secret = "test";
$expire = time() + 3600;# Link 1 hours expire 1小时过期
$md5 = base64_encode(md5($secret . $path . $expire, true));
$md5 = strtr($md5, '+/', '-_');
$md5 = str_replace('=', '', $md5);
$url = $cdn.$path."?s=".$md5."&e=".$expire;
echo $url."<br>";
$seo = $cdn."/".$md5."/".$expire.$path;
echo $seo;
假设小第有个视频 http://test.com/123.mp4
那请问要怎么串入HTML5播放器(<video src="(*)" controls></video>,才可以刷新后变换不同网址达到防盗效果
请教各位大大谢谢
页:
[1]