nginx webdav允许对用户的写访问和对异常的读访问

问题描述 投票:1回答:1

我正在尝试在nginx中设置一个webdav文件夹,只有一个用户可以在其中写入/删除/创建,但匿名用户可以读取。

我的文件夹的nginx配置看起来像这样:

  location /webdav/joe/ {
      client_body_temp_path /tmp;
      dav_methods  PUT DELETE MKCOL COPY MOVE;
      dav_ext_methods PROPFIND OPTIONS;
      limit_except GET PROPFIND OPTIONS { }
      create_full_put_path  on;
      dav_access    user:rw group:rw all:r;

      fancyindex    on;
      fancyindex_exact_size off;
      auth_basic "Restricted Access";
      auth_basic_user_file /etc/nginx/auth/joe;
     }

以上内容正确地限制了对joe的访问(joe是其中包含用户joe的httppasswd文件)。但无法通过http进入,提示输入密码,因此仅适用于joe。

nginx webdav
1个回答
0
投票

我终于做到了这一点:

    location /webdav/joe/ {
            client_body_temp_path /tmp;

            dav_methods  PUT DELETE MKCOL COPY MOVE;
            dav_ext_methods PROPFIND OPTIONS;
            dav_access    user:rw group:rw all:r;
            create_full_put_path  on;
            client_max_body_size 100M;

            limit_except GET PROPFIND OPTIONS HEAD {
              auth_basic "Restricted Access";
              auth_basic_user_file /etc/nginx/auth/joe;
           }

            fancyindex    on;
            fancyindex_exact_size off;
    }
© www.soinside.com 2019 - 2024. All rights reserved.