Quantcast
Channel: Nginx Forum - Nginx Mailing List - Russian
Viewing all articles
Browse latest Browse all 3102

Установка модуля | http_secure_link_module & mp4 (no replies)

$
0
0
Здравствуйте форумчане. Недавно появилась задача установки модуля http_secure_link_module в связке с http_mp4_module. Последний я установил верно, всё работает отлично, как часы, но вот http_secure_link_module наотрез отказывается работать.

Привожу nginx -V:

nginx version: nginx/1.2.1
built by gcc 4.7.2 (Debian 4.7.2-5)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --with-http_mp4_module --with-http_secure_link_module

Как видно, модуль есть в сборке.
Покопавшись в интернете, настраиваю модуль http_secure_link_module:

location /get/ {
rewrite /getvideo/([a-zA-Z0-9_\-]*)/([0-9]*)/(.*)\.mp4$ /video/$3.mp4?secl=$1&sect=$2;
}

location ~ /video/(.*)\.mp4$ {
secure_link $arg_secl,$arg_sect;
secure_link_md5 secretword$uri$arg_sect$remote_addr;
if ($secure_link = "") { return 403; }
if ($secure_link = "0") { return 404; }
rewrite ^/video/(.*)$ /video/$1 break;
root /home/project1/videos;
}

Файлы у меня лежат в дирректории /home/project1/videos. Структура папок древовидная, то есть видео у меня хранится, например, в /home/project1/videos/a1/b2/c3/a1b2c3.mp4

generate.php - генерация ссылки:

$name = "a1/b2/c3/a1b2c3.mp4";
$secret = 'secretword';
$time = time() + 10800; //ссылка будет рабочей три часа
$key = str_replace("=", "", strtr(base64_encode(md5($secret.'/home/project1/videos/'.$name.$time.getenv("REMOTE_ADDR"), TRUE)), "+/", "-_"));
$encoded_url = "http://site.ru/get/$key/$time/$name";
echo $encoded_url;

Я не могу понять, где написано в конфиге, откуда брать видео?
При открытии ссылки сгенерированной, 403 ошибку показывает. Прошу помощи, профессионалы. Весь день изучал гугл, пытался сделать сам. Заранее благодарю.

Viewing all articles
Browse latest Browse all 3102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>