HttpSecureLinkModule Q?

izrodix nginx-forum at nginx.us
Sat Dec 25 11:06:01 MSK 2010


Thanks Guys for the replies,
this configuration works for me.

    location ~ ^/vstore/(?[\w\-=]+,\d+)(?/.*\.mp4)$ {
        secure_link $secure;
        secure_link_md5 $secure_link_expires.$file.SECRET;

        if ($secure_link = "") {
                return 403;
        }

        if ($secure_link = 0) {
                return 410;
        }

        alias /store$file;
        mp4;
    }

$secret_word = "SECRET";
$uri_prefix = "http://127.0.0.1/vstore/";
$file = '/subdir1/subdir2/file.mp4';
$time = time()+600;
$secret = md5($time.'.'.$file.'.'.$secret_word, true);
$secret = strtr(base64_encode($secret), '+/', '-_');

echo $hash_url = $uri_prefix.$secret.','.$time.$file;

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,160061,161000#msg-161000




More information about the nginx mailing list