On Mon, Nov 23, 2020 at 03:22:00PM +0800, Cui Yili wrote:
[why] Use curl to upload files, cannot add symbolic links.
[how] nginx adds a symbolic link locally after receiving the file.
Signed-off-by: cuiyili 2268260388@qq.com
container/result-webdav/nginx.conf | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/container/result-webdav/nginx.conf b/container/result-webdav/nginx.conf index 5ef3647..c9199ed 100644 --- a/container/result-webdav/nginx.conf +++ b/container/result-webdav/nginx.conf @@ -14,7 +14,7 @@ http { server_tokens off; client_max_body_size 100m;
- location / {
- location /result { allow all; root /srv/;
@@ -39,6 +39,32 @@ http { io.close(f) } }
- location /initrd {
allow all;
root /srv/;
autoindex on;
create_full_put_path on;
dav_methods PUT MKCOL;
dav_access user:rw group:rw all:rw;
access_by_lua_block {
uri = ngx.var.request_uri
path = string.match(uri,"%g*/")
uploadfile = string.match(uri, ".+/([^/]*%.%w+)$")
seconddir = string.match(uri, "/.+/(.*)/.+")
if (seconddir == "pkg")
then
linkname = "latest.cgz"
else
linkname = string.match(uploadfile, "(.*)_%d+%.cgz")..".cgz"
end
The var name should use "_" to join each word.
Thanks, Xueliang
root_patch = "/srv/"..path
io.popen("cd "..root_patch.."&& ln -sf "..uploadfile.." "..linkname)
}
}
}
}
2.23.0