Помогите пожалуйста разобраться с HttpSecureLinkModule. Делаю все по инструкции http://wiki.nginx.org/HttpSecureLinkModule, но почему-то не получается.
Задача: отдавать по разным ссылкам видео в зависимости от IP юзера.
Создаю локейшен:
location /video/ {
## This must match the URI part related to the MD5 hash and expiration time.
secure_link $arg_st;
## This is how the MD5 hash is built from a secret token, an URI and an
## expiration time.
secure_link_md5 qp3mc84ha0m46c$uri$remote_addr;
## If the hash is incorrect then $secure_link is a null string.
if ($secure_link = "") {
return 403;
}
## The current local time is greater than the specified expiration time.
if ($secure_link = "0") {
return 403;
}
## If everything is ok $secure_link is 1.
}
Делаю /etc/init.d/nginx reload чтобы подхватить новый конфиг.
Создаю в каталоге qp3mc84ha0m46c/video/files/ файл top_secret.pdf
Для проверки генерю вручную нужную ссылку, по которой он должен отдаваться:
php -r 'print str_replace("=", "", strtr(base64_encode(md5("qp3mc84ha0m46c/video/files/top_secret.pdf46.185.43.130", TRUE)), "+/", "-_")) . "\n";'
где 46.185.43.130 - мой IP.
Получается:
1aucwvhDHWfwAaDJuw1QrQ
Потом пробую получить файл:
http://site.ru/video/files/top_secret.pdf?st=1aucwvhDHWfwAaDJuw1QrQ
В результате 404 Not Found nginx/1.0.6
А так http://site.ru/qp3mc84ha0m46c/video/files/top_secret.pdf - все нормально - 200 с отдачей файла.
Что я делаю не так?