响应式布局,支持PC与手机浏览器,只使用了HTML + JavaScript + Nginx 实现文件管理功能;而tiny file manager 需要 php 环境,当然,tiny file还支持多用户的隔离。


Nginx 的 autoindex + WebDAV 配置
location = /WebDavManager.html {
default_type text/html;
# 页面开启认证,避免未授权访问
auth_basic "Restricted WebDAV Manager";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
}
location /dav/ {
alias /data/downloads/;
index off; # 强制访问/dav/时,返回autoindex列表,而不是index.html文件
# 1. 自动索引(用于列目录)
autoindex on;
autoindex_format json; # json 格式
autoindex_localtime on; # 文件(修改)时间是服务器时间
autoindex_exact_size off; # 大小自动显示MB/GB单位
# 2. HTTP Basic 认证
auth_basic "Restricted WebDAV";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd; # 密码文件路径
# 3. WebDAV 方法配置
dav_methods PUT DELETE MKCOL COPY MOVE;
create_full_put_path on; # 允许 PUT 时自动创建目录
dav_access user:rw group:rw all:r;
client_max_body_size 15M; # 限制上传文件大小(按需调整)
# 4. 可选:CORS 配置(若前端页面与接口不同域时启用)
# add_header Access-Control-Allow-Origin *;
# add_header Access-Control-Allow-Methods "GET, PUT, DELETE, MOVE, MKCOL, OPTIONS";
# add_header Access-Control-Allow-Headers "Authorization, Destination, Content-Type";
# if ($request_method = OPTIONS) { return 204; }
}
发表回复