惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
博客园_首页
云风的 BLOG
云风的 BLOG
月光博客
月光博客
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
D
Docker
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 叶小钗
Martin Fowler
Martin Fowler
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog

挖井

免费搭建域名邮箱,使用Cloudflare、Mailgun和Gmail 被优化了 C++ Builder12.1试用体验 Windows平台使调试器在子进程启动时attach 更新FreeBSD、NetBSD、OpenBSD、DragonflyBSD 湖州龙之梦乐园跨年 修改DNS去广告 武夷山之旅 配置Debian路由器双WAN接入
Debian上使用Nginx搭建WebDav服务要点
missdeer · 2023-07-18 · via 挖井

要点:

  1. 不要用Nginx官方的源,而是用Debian的源安装Nginx
  2. 一键安装Nginx及扩展:sudo aptitude -y install nginx-full nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam
  3. 配置要给zone分配内存:dav_ext_lock_zone zone=webdav:10m;

最容易出问题的就是以上3点,其他配置从网上抄一下就行,大体如下:

location / {
    root /home/missdeer/;
    dav_methods PUT DELETE MKCOL COPY MOVE;
    dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
    dav_access user:rw group:rw all:rw;
    dav_ext_lock zone=webdav;

    client_max_body_size 102400M;
    create_full_put_path on;
    client_body_temp_path /tmp/;

    set $dest $http_destination;
    if (-d $request_filename) {
        rewrite ^(.*[^/])$ $1/;
        set $dest $dest/;
    }

    if ($request_method ~ (MOVE|COPY)) {
        more_set_input_headers 'Destination: $dest';
    }

    if ($request_method ~ MKCOL) {
        rewrite ^(.*[^/])$ $1/ break;
    }

    auth_pam "Restricted";
    auth_pam_service_name "common-auth";

    index index.html index.htm index.php admin.php;
}

最后启用Nginx:sudo systemctl restart nginx

如果起不来,先看一下配置文件是否有问题:sudo /sbin/nginx -t