NGINX安全链接不工作

NGINX安全链接不工作,nginx,Nginx,我在CentOS上设置了NGINX,并设置了配置文件以防止直接访问视频文件。 这是我使用的示例代码 location /videos/ { valid_referers none blocked abccc.com; if ($invalid_referer) { return 403; } root /var/cdn/videos/; ## This must match the URI part relate

我在CentOS上设置了NGINX,并设置了配置文件以防止直接访问视频文件。 这是我使用的示例代码

    location /videos/ {
    valid_referers none blocked abccc.com;
    if ($invalid_referer) {
        return 403;
    }   
     root      /var/cdn/videos/;

    ## This must match the URI part related to the MD5 hash and expiration time.
    secure_link $arg_st,$arg_e;      
    ## The MD5 hash is built from our secret token, the URI($path in PHP) and our expiration time.
    secure_link_md5 Gf1Pv52EifS1f8G9agn2k2n8a$uri$arg_e;         
    ## 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;
    }

    gzip off;
    gzip_static off;
    mp4;
    flv;
    mp4_buffer_size        5M;
    mp4_max_buffer_size    10M;
    #mp4_limit_rate        on;
    #mp4_limit_rate_after  30s;     

    ## If everything is ok $secure_link is 1.
    rewrite ^/videos/(.*)$ /videos/$1 break;
}
但当重新启动服务器并测试它时,我仍然可以通过访问文件夹中的视频文件 直接url和安全链接

另一方面,当我尝试在localhost中使用此配置时,它工作得非常好


我做错了什么?

重写规则中的替换链接似乎不会更改匹配的URL模式。你确定你说的对吗?