Files
auto-index/nginx.conf

32 lines
956 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /var/www/files; # 确认这是你的文件存放目录
charset utf-8;
location = /_ui_injection.html {
internal;
alias /var/www/autoindex/ui.html;
}
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
add_after_body /_ui_injection.html;
# WebDAV 核心功能
dav_methods PUT DELETE MKCOL COPY MOVE;
create_full_put_path on;
client_max_body_size 0; # 允许大文件上传
dav_access user:rw group:rw all:rw; # 核心:解决权限控制
# 跨域设置
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, MKCOL, COPY, MOVE, PROPFIND' always;
add_header 'Access-Control-Allow-Headers' '*' always;
if ($request_method = 'OPTIONS') { return 204; }
}
}