我正在尝试使用 Nginx 设置一个可供两种类型的用户访问的 WebDav 服务器。只读和读写。用户希望将其安装为Windows 驱动器。
我可以在 Chrome 中打开共享,也可以使用 CyberDuck 或 FileZilla 等程序打开共享。但是,当尝试在 Windows 中将共享安装为驱动器时,它一直要求输入凭据。
这是我的 Nginx 主机配置:
server {
listen 80;
listen [::]:80;
server_name example.com;
auth_basic realm_name;
auth_basic_user_file /srv/example.com/nginx/.passwords.list;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;
client_body_temp_path /srv/example.com/tmp;
client_max_body_size 0;
create_full_put_path on;
root /srv/example.com/dav;
autoindex on;
location / {
limit_except GET PROPFIND OPTIONS HEAD {
auth_basic "Restricted Access";
auth_basic_user_file /srv/example.com/nginx/.admins.list;
}
}
access_log /var/log/nginx/webdav_access.log;
error_log /var/log/nginx/webdav_error.log debug;
}
尝试连接时,错误日志中出现以下信息:
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "Host: example.com"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "X-Forwarded-Proto: http"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "X-Forwarded-Port: 443"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "X-Forwarded-By: <redacted>:80"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "X-Forwarded-For: <redacted>"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "X-Real-IP: <redacted>"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "Connection: close"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7601"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header: "translate: f"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http header done
2020/03/17 14:55:06 [debug] 24381#24381: *75 event timer del: 13: 623846535
2020/03/17 14:55:06 [debug] 24381#24381: *75 generic phase: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 rewrite phase: 1
2020/03/17 14:55:06 [debug] 24381#24381: *75 test location: "/"
2020/03/17 14:55:06 [debug] 24381#24381: *75 using configuration "/"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http cl:-1 max:0
2020/03/17 14:55:06 [debug] 24381#24381: *75 rewrite phase: 3
2020/03/17 14:55:06 [debug] 24381#24381: *75 post rewrite phase: 4
2020/03/17 14:55:06 [debug] 24381#24381: *75 generic phase: 5
2020/03/17 14:55:06 [debug] 24381#24381: *75 generic phase: 6
2020/03/17 14:55:06 [debug] 24381#24381: *75 generic phase: 7
2020/03/17 14:55:06 [debug] 24381#24381: *75 access phase: 8
2020/03/17 14:55:06 [debug] 24381#24381: *75 access phase: 9
2020/03/17 14:55:06 [debug] 24381#24381: *75 access phase: 10
2020/03/17 14:55:06 [info] 24381#24381: *75 no user/password was provided for basic authentication, client: <redacted>, server: example.com, request: "OPTIONS / HTTP/1.0", host: "example.com"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http finalize request: 401, "/?" a:1, c:1
2020/03/17 14:55:06 [debug] 24381#24381: *75 http special response: 401, "/?"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http set discard body
2020/03/17 14:55:06 [debug] 24381#24381: *75 xslt filter header
2020/03/17 14:55:06 [debug] 24381#24381: *75 HTTP/1.1 401 Unauthorized
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 17 Mar 2020 13:55:06 GMT
Content-Type: text/html
Content-Length: 204
Connection: close
WWW-Authenticate: Basic realm="realm_name"
2020/03/17 14:55:06 [debug] 24381#24381: *75 write new buf t:1 f:0 0000560265059860, pos 0000560265059860, size: 206 file: 0, size: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 http write filter: l:0 f:0 s:206
2020/03/17 14:55:06 [debug] 24381#24381: *75 http output filter "/?"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http copy filter: "/?"
2020/03/17 14:55:06 [debug] 24381#24381: *75 image filter
2020/03/17 14:55:06 [debug] 24381#24381: *75 xslt filter body
2020/03/17 14:55:06 [debug] 24381#24381: *75 http postpone filter "/?" 000056026500F2D0
2020/03/17 14:55:06 [debug] 24381#24381: *75 write old buf t:1 f:0 0000560265059860, pos 0000560265059860, size: 206 file: 0, size: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 write new buf t:0 f:0 0000000000000000, pos 0000560264CB0A20, size: 142 file: 0, size: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 write new buf t:0 f:0 0000000000000000, pos 0000560264CB10A0, size: 62 file: 0, size: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 http write filter: l:1 f:0 s:410
2020/03/17 14:55:06 [debug] 24381#24381: *75 http write filter limit 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 writev: 410 of 410
2020/03/17 14:55:06 [debug] 24381#24381: *75 http write filter 0000000000000000
2020/03/17 14:55:06 [debug] 24381#24381: *75 http copy filter: 0 "/?"
2020/03/17 14:55:06 [debug] 24381#24381: *75 http finalize request: 0, "/?" a:1, c:1
2020/03/17 14:55:06 [debug] 24381#24381: *75 http request count:1 blk:0
2020/03/17 14:55:06 [debug] 24381#24381: *75 http close request
2020/03/17 14:55:06 [debug] 24381#24381: *75 http log handler
2020/03/17 14:55:06 [debug] 24381#24381: *75 free: 000056026500E2F0, unused: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 free: 0000560265059480, unused: 2580
2020/03/17 14:55:06 [debug] 24381#24381: *75 close http connection: 13
2020/03/17 14:55:06 [debug] 24381#24381: *75 reusable connection: 0
2020/03/17 14:55:06 [debug] 24381#24381: *75 free: 0000560264FF79F0
2020/03/17 14:55:06 [debug] 24381#24381: *75 free: 0000560264FF6FE0, unused: 136
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "Host: example.com"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "X-Forwarded-Proto: http"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "X-Forwarded-Port: 443"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "X-Forwarded-By: <redacted>:80"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "X-Forwarded-For: <redacted>"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "X-Real-IP: <redacted>"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "Connection: close"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7601"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header: "translate: f"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http header done
2020/03/17 14:55:09 [debug] 24381#24381: *76 event timer del: 13: 623849087
2020/03/17 14:55:09 [debug] 24381#24381: *76 generic phase: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 rewrite phase: 1
2020/03/17 14:55:09 [debug] 24381#24381: *76 test location: "/"
2020/03/17 14:55:09 [debug] 24381#24381: *76 using configuration "/"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http cl:-1 max:0
2020/03/17 14:55:09 [debug] 24381#24381: *76 rewrite phase: 3
2020/03/17 14:55:09 [debug] 24381#24381: *76 post rewrite phase: 4
2020/03/17 14:55:09 [debug] 24381#24381: *76 generic phase: 5
2020/03/17 14:55:09 [debug] 24381#24381: *76 generic phase: 6
2020/03/17 14:55:09 [debug] 24381#24381: *76 generic phase: 7
2020/03/17 14:55:09 [debug] 24381#24381: *76 access phase: 8
2020/03/17 14:55:09 [debug] 24381#24381: *76 access phase: 9
2020/03/17 14:55:09 [debug] 24381#24381: *76 access phase: 10
2020/03/17 14:55:09 [info] 24381#24381: *76 no user/password was provided for basic authentication, client: <redacted>, server: example.com, request: "OPTIONS / HTTP/1.0", host: "example.com"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http finalize request: 401, "/?" a:1, c:1
2020/03/17 14:55:09 [debug] 24381#24381: *76 http special response: 401, "/?"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http set discard body
2020/03/17 14:55:09 [debug] 24381#24381: *76 xslt filter header
2020/03/17 14:55:09 [debug] 24381#24381: *76 HTTP/1.1 401 Unauthorized
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 17 Mar 2020 13:55:09 GMT
Content-Type: text/html
Content-Length: 204
Connection: close
WWW-Authenticate: Basic realm="realm_name"
2020/03/17 14:55:09 [debug] 24381#24381: *76 write new buf t:1 f:0 0000560265059860, pos 0000560265059860, size: 206 file: 0, size: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 http write filter: l:0 f:0 s:206
2020/03/17 14:55:09 [debug] 24381#24381: *76 http output filter "/?"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http copy filter: "/?"
2020/03/17 14:55:09 [debug] 24381#24381: *76 image filter
2020/03/17 14:55:09 [debug] 24381#24381: *76 xslt filter body
2020/03/17 14:55:09 [debug] 24381#24381: *76 http postpone filter "/?" 000056026500F2D0
2020/03/17 14:55:09 [debug] 24381#24381: *76 write old buf t:1 f:0 0000560265059860, pos 0000560265059860, size: 206 file: 0, size: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 write new buf t:0 f:0 0000000000000000, pos 0000560264CB0A20, size: 142 file: 0, size: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 write new buf t:0 f:0 0000000000000000, pos 0000560264CB10A0, size: 62 file: 0, size: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 http write filter: l:1 f:0 s:410
2020/03/17 14:55:09 [debug] 24381#24381: *76 http write filter limit 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 writev: 410 of 410
2020/03/17 14:55:09 [debug] 24381#24381: *76 http write filter 0000000000000000
2020/03/17 14:55:09 [debug] 24381#24381: *76 http copy filter: 0 "/?"
2020/03/17 14:55:09 [debug] 24381#24381: *76 http finalize request: 0, "/?" a:1, c:1
2020/03/17 14:55:09 [debug] 24381#24381: *76 http request count:1 blk:0
2020/03/17 14:55:09 [debug] 24381#24381: *76 http close request
2020/03/17 14:55:09 [debug] 24381#24381: *76 http log handler
2020/03/17 14:55:09 [debug] 24381#24381: *76 free: 000056026500E2F0, unused: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 free: 0000560265059480, unused: 2580
2020/03/17 14:55:09 [debug] 24381#24381: *76 close http connection: 13
2020/03/17 14:55:09 [debug] 24381#24381: *76 reusable connection: 0
2020/03/17 14:55:09 [debug] 24381#24381: *76 free: 0000560264FF79F0
2020/03/17 14:55:09 [debug] 24381#24381: *76 free: 0000560264FF6FE0, unused: 136
Nginx 提示“未提供用于基本身份验证的用户/密码”,但实际上已提供。这可能是什么原因造成的?