nginx webdav 无法打开集合

标签 nginx webdav

我在freebsd系统上构建了nginx,配置参数如下:
./configure ... –with-http_dav_module
现在这是我的配置文件:

user www www;
worker_processes  1;

events {
    worker_connections  1024;
}

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

    # reserve 1MB under the name 'proxied' to track uploads
    upload_progress proxied 1m;

    sendfile        on;
    #tcp_nopush     on;
    client_max_body_size 500m;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    #upload_store /var/tmp/firmware;
    client_body_temp_path /var/tmp/firmware;


    server {
      server_name localhost;
      listen 8080;

      auth_basic "Restricted";
      auth_basic_user_file /root/.htpasswdfile;

      create_full_put_path on;
      client_max_body_size 50m;
      dav_access user:rw group:r all:r;
      dav_methods PUT DELETE MKCOL COPY MOVE;
      autoindex on;
      root /root;

      location / {
      }
    }
}

现在,我接下来要做的是通过发出 nginx -t 检查配置文件的语法。然后按如下方式优雅地重新加载:nginx -s reload .

现在,当我将我的网络浏览器指向 nginx-ip-address:8080 时,我会得到我的文件和文件夹的列表等等(我认为这是由于自动索引功能)。

但问题是,当我尝试使用 cadaver 测试 webdav 时,如下所示:
cadaver http://nginx-ip-address:8080/
它要求我输入授权凭据,然后在我输入之后它给了我以下错误:
Could not open Collection: 405 Not Allowed
以下是同时出现的 nginx-error-log 行:
*125 no user/password was provided for basic authentication, client: 172.16.255.1, server: localhost, request: "OPTIONS / HTTP/1.1", host: "172.16.255.129:8080"
当我尝试从网络浏览器访问用户名和密码时,用户名和密码工作正常,那么这里发生了什么?

最佳答案

事实证明,nginx 内置的 webdav 模块已损坏,要启用完整的 webdav,我们需要添加以下外部 3rd 方模块:nginx-dav-ext-module。

链接到它的github:https://github.com/arut/nginx-dav-ext-module.git

配置参数现在是:
./configure --with-http_dav_module --add-module=/path/to/the/above/module
内置的只是提供PUT DELETE MKCOL COPY MOVE dav 方法。

nginx-dav-ext-module 添加了以下额外的 dav 方法:PROPFIND OPTIONS
您还需要编辑配置文件以添加以下行:
dav_ext_methods PROPFIND OPTIONS;
这样做后,通过发出以下命令检查 conf 文件的语法是否完整:nginx -t
然后软重新加载(优雅地)nginx:nginx -s reload
瞧!您现在应该能够使用 cadaver 或任何其他 dav 客户端程序进入目录。

我不敢相信我解决了这个问题,它让我发疯了一段时间!

关于nginx webdav 无法打开集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24666457/

相关文章:

ssl - 如何配置 Nginx 网络服务器以使用 AWS RDS SSL,同时在 Nginx 网络服务器和访问者浏览器之间维护 https

用于本地 HTTPS 的 Docker WSL2 SSL 证书

ruby-on-rails - 使用 passenger + nginx 时 Rails 应用程序非常慢

c - 按需读取,如何在不下载的情况下从在线大文件中读取前256字节?

macos - OSX 10.9 - Mavericks webdav 客户端锁定问题

php - Owncloud 同步应用程序 LDAP 身份验证

php - 如何在我的工作流程中使用 Git

ubuntu - nginx.service 启动失败 : Unit nginx. 找不到服务

c# - Windows shell 扩展的跨平台替代品 - WebDAV 平台?

ubuntu - 如何使用运行 LEMP 的 Google Compute Engine 使用 PhpStorm 设置远程项目?