nginx - nginx webdav 允许对用户进行写访问和对 annoymous 进行读访问
问题描述
我正在尝试在 nginx 中设置一个 webdav 文件夹,只有一个用户可以写入/删除/创建,但匿名用户可以读取。
我的文件夹的 nginx 配置如下所示:
location /webdav/joe/ {
client_body_temp_path /tmp;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
limit_except GET PROPFIND OPTIONS { }
create_full_put_path on;
dav_access user:rw group:rw all:r;
fancyindex on;
fancyindex_exact_size off;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/auth/joe;
}
以上正确限制了对 joe 的访问(joe 是其中包含用户 joe 的 httppasswd 文件)。但不能通过http,给出密码提示,所以只适用于joe。
解决方案
我终于通过这样做得到了这个工作:
location /webdav/joe/ {
client_body_temp_path /tmp;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;
create_full_put_path on;
client_max_body_size 100M;
limit_except GET PROPFIND OPTIONS HEAD {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/auth/joe;
}
fancyindex on;
fancyindex_exact_size off;
}
推荐阅读
- spring-boot - 兼容 Spring Eureka 版本
- html - 如何使 Blogger 帖子表可滚动
- azure-devops - 将 Azure 屏幕分辨率实用程序与 .yaml 文件一起使用
- javascript - 如何阻止历史重新路由
- vue.js - 如何从 D3 js 文件中调用 Vue 组件方法
- python - Python strip 方法在数据框列中不起作用
- wagtail - 联系表格未保存在 wagtail 管理员中
- javascript - react-native 如何定位移动应用的用户?
- flutter - 播放 m3u8 文件 Flutter Web with Close Captioning + Common Controls
- javascript - Node.js 函数未在我的 Visual Studio 代码终端中显示输出