【问题标题】:nginx webdav allow write access to users and read access to annoymousnginx webdav 允许对用户进行写访问和对匿名用户进行读访问
【发布时间】:2019-04-30 00:33:16
【问题描述】:

我正在尝试在 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】:

    我终于通过这样做得到了这个工作:

        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;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-03
      • 2014-03-19
      • 1970-01-01
      • 2019-05-09
      • 1970-01-01
      • 2010-12-05
      • 2020-12-26
      • 2016-08-26
      相关资源
      最近更新 更多