此模块计算和检查要求所需的安全链接网址。此模块默认情况下不会被编译启用,要启用它请使用指令
--with-http_secure_link_module
参与编译安装 nginx 。注意:此模块仅在 nginx 版本为0.7.18或更高时才被支持。
配置实例:
location /p/ { location ~ ^/p/(?<secure>[\w\-=]+,\d+)(?<file>/.+)$ { secure_link $secure; secure_link_md5 $secure_link_expires.$file.PASSWORD; if ($secure_link = "") { return 403; } if ($secure_link == 0) { return 410; } alias /path/to$file; } return 404; error_page 403 /forbidden.html; error_page 404 /not_found.html; error_page 410 =403 /link_expired.html; }
变量
$secure_link
变量 $secure_link 有如下值:
"" - 不正确的链接 "0" - 过期链接 "1" - 正确链接
$secure_link_expires
变量 $secure_link_expires 时间值 。
时间: 2024-09-20 07:37:16