nginx WebDAV PROPFIND,OPTIONS,LOCK,UNLOCK support.
Contents
The standard ngx_http_dav_module provides partial WebDAV implementation and only supports GET,HEAD,PUT,DELETE,MKCOL,COPY,MOVE methods.
For full WebDAV support in nginx you need to enable the standard ngx_http_dav_module as well as this module for the missing methods.
Building nginx with the module:
# static module
$ ./configure --with-http_dav_module --add-module=/path/to/nginx-dav-ext-module
# dynamic module
$ ./configure --with-http_dav_module --add-dynamic-module=/path/to/nginx-dav-ext-module
Trying to compile nginx with this module but without ngx_http_dav_module will result in compilation error.
libxml2
+ libxslt
The libxslt
library is technically redundant and is only required since this
combination is supported by nginx for the xslt module.
Using builtin nginx mechanisms for linking against third-party libraries
brings certain compatibility benefits.
However this redundancy can be easily eliminated in the config
file.
The module tests require standard nginx-tests and Perl HTTP::DAV
library.
$ export PERL5LIB=/path/to/nginx-tests/lib
$ export TEST_NGINX_BINARY=/path/to/nginx
$ prove t
Syntax: | dav_ext_methods [PROPFIND] [OPTIONS] [LOCK] [UNLOCK] |
Context: | http, server, location |
Enables support for the specified WebDAV methods in the current scope.
Syntax: | dav_ext_lock_zone zone=NAME:SIZE [timeout=TIMEOUT] |
Context: | http |
Defines a shared zone for WebDAV locks with specified NAME and SIZE. Also, defines a lock expiration TIMEOUT. Default lock timeout value is 1 minute.
Syntax: | dav_ext_lock zone=NAME |
Context: | http, server, location |
Enables WebDAV locking in the specified scope.
Locks are stored in the shared zone specified by NAME.
This zone must be defined with the dav_ext_lock_zone
directive.
Note that even though this directive enables locking capabilities in the
current scope, HTTP methods LOCK and UNLOCK should also be explicitly specified
in the dav_ext_methods
.
Simple lockless example:
location / { root /data/www; dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS; }
WebDAV with locking:
http { dav_ext_lock_zone zone=foo:10m; ... server { ... location / { root /data/www; dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK; dav_ext_lock zone=foo; } } }
WebDAV with locking which works with MacOS client:
http { dav_ext_lock_zone zone=foo:10m; ... server { ... location / { root /data/www; # enable creating directories without trailing slash set $x $uri$request_method; if ($x ~ [^/]MKCOL$) { rewrite ^(.*)$ $1/; } dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK; dav_ext_lock zone=foo; } } }
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。