pid       /tmp/nginx.pid;
error_log stderr;
worker_processes 1;
daemon off;
load_module "/usr/lib/nginx/modules/ngx_http_dav_ext_module.so";

events {
  worker_connections  1024;
}

http {
  include             /etc/nginx/mime.types;
  default_type        application/octet-stream;

  dav_ext_lock_zone zone=foo:10m;

  sendfile on;

  keepalive_timeout   65;

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
  ssl_prefer_server_ciphers on;
  access_log /tmp/access.log;
  error_log /tmp/error.log;
  proxy_temp_path /tmp/proxy_temp_path;
  client_body_temp_path /tmp/client_body_temp_path/;
  fastcgi_temp_path /tmp/fastcgi_temp_path;
  uwsgi_temp_path /tmp/uwsgi_temp_path;
  scgi_temp_path /tmp/scgi_temp_path;

  server {
    listen 8585 default_server;
    listen [::]:8585 default_server;
    root /tmp/www/;
    index index.html index.htm index.nginx-debian.html;
    server_name _;

    location / {
		autoindex on;
		if (-d $request_filename) { rewrite ^(.*[^/])$ $1/ break; }
		dav_methods PUT DELETE MKCOL COPY MOVE;
        dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
        dav_ext_lock zone=foo;
        dav_access user:rw group:rw all:rw;

		# enable creating directories without trailing slash
		set $x $uri$request_method;
		if ($x ~ [^/]MKCOL$) {
			rewrite ^(.*)$ $1/;
		}

        client_max_body_size 0;
        create_full_put_path on;
        client_body_temp_path /tmp/client_body_temp_path;

		auth_basic "Restricted Access";
		auth_basic_user_file ./nginx-user.conf;
    }
  }
}
