20 lines
657 B
Lua
20 lines
657 B
Lua
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
|
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
|
package.path = package.path .. ';<SCRIPT_PATH>/?.lua';
|
|
|
|
local _M = {}
|
|
|
|
--local strip_path = require("strip_path")
|
|
--local Upyun = require('upyun')
|
|
|
|
function _M.upt(uri) {
|
|
local secret = ngx.var.upt_secret
|
|
local duration = ngx.var.upt_duration
|
|
local etime = os.time() + duration
|
|
local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri)
|
|
ngx.log(ngx.ERR, 'sign...' .. sign .. ' etime..' .. etime)
|
|
local upt = string.sub(sign, 13, 13 + 7) .. etime
|
|
ngx.say(upt)
|
|
}
|
|
|
|
return _M |