apt install -y gcc make libpcre3-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev libgd-dev libgeoip-dev git
git clone https://github.com/arut/nginx-dav-ext-module.git
编译添加参数--with-http_dav_module --add-module=../nginx-dav-ext-module
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream --with-http_gzip_static_module --with-http_stub_status_module --with-pcre --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_secure_link_module --with-http_v2_module --with-http_dav_module --add-module=../nginx-dav-ext-module
make -j 4 && make install
echo 用户名:$(openssl passwd -crypt 密码) > /usr/local/nginx/conf/auth.db
location /webdav {
alias /data/web/webdav;
dav_methods PUT DELETE MKCOL COPY MOVE; #DAV支持的请求方法
dav_ext_methods PROPFIND OPTIONS; #DAV扩展支持的请求方法
charset utf-8; #设置为utf-8不然中文容易乱码
create_full_put_path on; #启用创建目录支持
dav_access user:rw group:r all:r; #设置新创建的文件和目录的访问权限
auth_basic "Authorized Users Only";
auth_basic_user_file /usr/local/nginx/conf/auth.db;
#limit_except GET PROPFIND OPTIONS HEAD { #匿名用户只有查看权限,登录用户才能进行读写操作
# auth_basic "Authorized Users Only";
# auth_basic_user_file /usr/local/nginx/conf/auth.db;
#}
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
min_delete_depth 0;
client_max_body_size 0;
}