本帖最后由 好鸭 于 2022-6-23 08:56 编辑
- cd /root/lnmp.org
- git clone https://github.com/arut/nginx-dav-ext-module
复制代码
然后在lnmp.conf的Nginx_Modules_Options加上’–with-http_dav_module –add-module=/root/lnmp1.9/nginx-dav-ext-module’
也就是Nginx_Modules_Options=’–with-http_dav_module –add-module=/root/lnmp1.9/nginx-dav-ext-module’
加ngx_brotli的在这https://hostloc.com/thread-1026247-1-1.html,图省事可以一起加上,虽然你可能都用不上
nginx配置
创建验证文件
- apt install apache2-utils
- htpasswd -c /usr/local/nginx/conf/webdav_htpasswd #会提示输入用户名密码
复制代码
我也是网上复制的,自己改改
- server {
- listen 80;
- server_name _;
- charset utf-8;
-
- access_log /home/wwwlogs/webdav.log;
- error_log /home/wwwlogs/webdav_error.log;
-
- location / {
- client_max_body_size 5G; # 最大允许上传文件大小
- alias /home/wwwroot/webdav/;
- index index.html index.htm;
- autoindex on;
- # autoindex_localtime on;
- set $dest $http_destination;
- # 对目录请求、对URI自动添加"/"
- if (-d $request_filename) {
- rewrite ^(.*[^/])$ $1/;
- set $dest $dest/;
- }
- #下面这个会报错,所以注释了
- # 对MOVE|COPY方法强制添加Destination请求头
- # if ($request_method ~ (MOVE|COPY)) {
- # more_set_input_headers ‘Destination: $dest’;
- # }
- if ($request_method ~ MKCOL) {
- rewrite ^(.*[^/])$ $1/ break;
- }
- # webdav config
- client_body_temp_path /tmp;
- dav_methods PUT DELETE MKCOL COPY MOVE; #DAV支持的请求方法
- dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK; # DAV扩展支持的请求方法
- create_full_put_path on; # 启用创建目录支持
- dav_access group:rw all:r; # 创建文件的以及目录的访问权限
- # auth_basic "Authorized Users Only";
- # auth_basic "Authorized Users WebDAV";
- auth_basic "user login";
- auth_basic_user_file /usr/local/nginx/conf/webdav_htpasswd;
- }
- }
复制代码
|