解决seafile在启动webdav并采用nginx反代时无法移动文件的情况

自渡
2024-08-02 / 0 评论 / 190 阅读

seafile支持webdav的方式来访问文件,但是官方给出的nginx反代语法存在bug,会导致无法在webdav上移动文件,,并出现502错误,现对配置文件做出修改:
m28qlt5w.png
seafdav.conf按照官方的写法不变:

[WEBDAV]
# Default is false. Change it to true to enable SeafDAV server.
enabled = true
port = 8080
# If you deploy seafdav behind nginx/apache, you need to modify "share_name".
share_name = /seafdav

nginx的配置修改如下:

  location /seafdav {
        proxy_pass         http://127.0.0.1:8080/seafdav;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_read_timeout  1200s;
        client_max_body_size 0;
       if ($destination ~* ^https\:\/\/yourdomain.com(.+)$) {
         set $destination http://127.0.0.1:8080$1;
      }
        access_log      /var/log/nginx/seafdav.access.log seafileformat;
        error_log       /var/log/nginx/seafdav.error.log;
    }
     location /:dir_browser {
        proxy_pass         http://127.0.0.1:8080/:dir_browser;
0

评论 (0)

取消