I implemented Nginx secure link module but can not get it working. I did read many posts on Serverfaulty and Stackowerflow but no success.
I want to restrict access to any full size /image/video files in directories:
/u/folder1/name.jpg
/u/folder2/name.mp4
at the same time I want to allow access to the thumbnails located
/u/folder1/thumb1/name.jpg
/u/folder1/thumb2/name.mp4
etc.
I tried different variants and this is the last:
location ^/u/[0-9a-z]+/\.(jpg|mp4)$ {
secure_link $arg_cdg,$arg_expires;
secure_link_md5 "$secure_link_expires$uri$remote_addr xxx";
if ($secure_link = "") { return 403; }
if ($secure_link = "0") { return 410; }
}
Actually, I don't need to list file types - I want to restrict access to any files in the second level subfolders - /u/anyfolder/anyfilename
Any help?