Update README.md (#12)
This commit is contained in:
@@ -227,9 +227,40 @@ location /image_append {
|
|||||||
|
|
||||||
# server contex 中添加location
|
# server contex 中添加location
|
||||||
|
|
||||||
#Donwload image use ngx.exec
|
#Donwload image use ngx.req.set_uri
|
||||||
location /download_image2 {
|
location /download_image {
|
||||||
content_by_lua_file /usr/local/openresty/nginx/conf/lua/download_image2.lua;
|
rewrite_by_lua_block {
|
||||||
|
ngx.log(ngx.INFO , "location /download_image")
|
||||||
|
|
||||||
|
-- TODO: jwt decoder
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Functions : String split
|
||||||
|
string.split = function(s, p)
|
||||||
|
local rt= {}
|
||||||
|
string.gsub(s, '[^'..p..']+', function(w) table.insert(rt, w) end )
|
||||||
|
return rt
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get url and split by '/' save into a table
|
||||||
|
local sub_url_table = string.split(ngx.var.uri, '/')
|
||||||
|
local sub_url_number = table.getn(sub_url_table)
|
||||||
|
|
||||||
|
for i = 1, sub_url_number do
|
||||||
|
ngx.log(ngx.INFO , "Sub url sub" .. i .. " : " .. sub_url_table[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
local uri = "/internal_file_upload/"..sub_url_table[sub_url_number]..".jpg"
|
||||||
|
ngx.log(ngx.INFO , "uri : " .. uri)
|
||||||
|
return ngx.req.set_uri(uri , true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Static file server
|
||||||
|
location /internal_file_upload {
|
||||||
|
internal;
|
||||||
|
try_files $uri /file_upload/8493acab-0f7a-47e0-8fff-e96b843334dd.jpg;
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user