Hello,
I configure NGINX to be a WebDAV server:
server {
listen 8283;
server_name 127.0.0.1;
root /home;
charset utf-8;
create_full_put_path on;
client_max_body_size 4g;
client_body_timeout 600s;
client_body_buffer_size 512k;
# for we can mv uploaded files in the same partition
client_body_temp_path /home/_tmp_/nginx 1 2;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;
location / {
deny all;
}
location ~ ^/users/(\w+)(/.*)?$ {
alias /home/$1$2;
auth_basic "emNAS";
auth_basic_user_file /opt/emnas/etc/webdav/$1.ht;
autoindex on;
}
}
I tested COPY and MOVE not work. Track the code with GDB, the problem
is in function ngx_http_dav_copy_move_handler() which calls ngx_http_map_uri_to_path()
to map destination URI to destination path. But it map destination URI to source path.
So the MOVE does nothing, the COPY report file exists error.
For example,
MOVE http://localhost:8283/users/admin/aaa to http://localhost:8283/users/admin/bbb
results an FS op
RENAME /home/admin/aaa to /home/admin/aaa
which does nothing.
The wrong path from correct URI is generated by ngx_http_script_run() which execute
some code from configuration.
I'm not familiar with NGINX, so I don't know where is the cause of this problem.
Is it an NGINX bug or my wrong configuration?
I tested NGINX 1.1.19, 1.2.1, 1.4.5, 1.5.10. They all have the problem.
Regards,
Qiang
I configure NGINX to be a WebDAV server:
server {
listen 8283;
server_name 127.0.0.1;
root /home;
charset utf-8;
create_full_put_path on;
client_max_body_size 4g;
client_body_timeout 600s;
client_body_buffer_size 512k;
# for we can mv uploaded files in the same partition
client_body_temp_path /home/_tmp_/nginx 1 2;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;
location / {
deny all;
}
location ~ ^/users/(\w+)(/.*)?$ {
alias /home/$1$2;
auth_basic "emNAS";
auth_basic_user_file /opt/emnas/etc/webdav/$1.ht;
autoindex on;
}
}
I tested COPY and MOVE not work. Track the code with GDB, the problem
is in function ngx_http_dav_copy_move_handler() which calls ngx_http_map_uri_to_path()
to map destination URI to destination path. But it map destination URI to source path.
So the MOVE does nothing, the COPY report file exists error.
For example,
MOVE http://localhost:8283/users/admin/aaa to http://localhost:8283/users/admin/bbb
results an FS op
RENAME /home/admin/aaa to /home/admin/aaa
which does nothing.
The wrong path from correct URI is generated by ngx_http_script_run() which execute
some code from configuration.
I'm not familiar with NGINX, so I don't know where is the cause of this problem.
Is it an NGINX bug or my wrong configuration?
I tested NGINX 1.1.19, 1.2.1, 1.4.5, 1.5.10. They all have the problem.
Regards,
Qiang