LR1234567
LR1234567

Reputation: 1246

nginx webdav allow write access to users and read access to annoymous

I'm trying to setup a webdav folder in nginx where by only one user can write/delete/create, but anonymous users can read.

my nginx config for the folder looks like this:

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

The above properly restricts access to just joe (joe is the httppasswd file with user joe in it). but can't going via http, gives a password prompt, so only works for joe.

Upvotes: 6

Views: 6102

Answers (1)

LR1234567
LR1234567

Reputation: 1246

I finally did get this working by doing this:

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

Upvotes: 8

Related Questions