NGINX防盗链 伪静态重写 nginx secure link rewrite the MP4/FLV File Link

nginx secure link rewrite the MP4/FLV File Link

Nginx is Fast web server software, look it in www.nginx.org

if you used secure link mod
the link like is
http://www.test.com/media/000.mp4?s=oJ-RnINtL028POIlzeLXGA&e=1381153610
but we like that

How To Get The rewrite clean link?

this examples nginx.conf

This PHP Test code

now your can get two link
the $url is STD URL like
http://www.test.com/media/000.mp4?s=oJ-RnINtL028POIlzeLXGA&e=1381153610

the $seo is url friend link like

Good luck!!!

One thought on “NGINX防盗链 伪静态重写 nginx secure link rewrite the MP4/FLV File Link

  1. hello , can you help me solve this please .

    server {
    listen 80;
    server_name _;
    root /home/ongoing;
    error_log /var/log/nginx/error.log;
    location / {
    try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }
    location ~ \.mp4$ {
    rewrite ^(.*)/(.+)\.mp4$ $1/$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;
    }
    }

    my folder path is like this title/titlemovie.mp4 (title has diffrent name)

    how to make the rewrite rules ?

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注