Nginx配置Webdav服务器

1 配置

server {
    ....
    location /webdav {
        alias /tmp/webdav;
        autoindex on;
        dav_methods PUT DELETE MKCOL COPY MOVE;
        #dav_ext_methods PROPFIND OPTIONS;
        dav_access user:rw group:rw all:r;

        client_max_body_size 128M;
        create_full_put_path on;
        client_body_temp_path /tmp/;

        auth_basic              webdav;
        auth_basic_user_file    /etc/nginx/.passwords.list;
    }

}

需要注意,alias(即存储目录)必须父目录也有权限..

2 帐号

sudo htpasswd -b -c /etc/nginx/.passwords.list user1 pass1

3 测试

curl -u user1:pass1 -T './file' 'http://127.0.0.1/webdav/'

 

Leave a Reply

Your email address will not be published. Required fields are marked *