Initial commit: Nginx Autoindex文件列表系统

This commit is contained in:
autoindex
2025-12-03 04:15:17 +00:00
commit 309dd0378a
9 changed files with 995 additions and 0 deletions

38
nginx.conf Normal file
View File

@@ -0,0 +1,38 @@
server {
listen 80;
server_name _;
root /var/www/files;
charset utf-8;
# 禁用access log以提高性能可选
# access_log off;
location / {
# 启用autoindex
autoindex on;
autoindex_exact_size off; # 显示KB/MB而不是字节
autoindex_localtime on; # 使用本地时间
autoindex_format html;
# 注入自定义样式
add_before_body /autoindex-header.html;
add_after_body /autoindex-footer.html;
}
# 提供header文件
location = /autoindex-header.html {
alias /var/www/autoindex/header.html;
}
# 提供footer文件
location = /autoindex-footer.html {
alias /var/www/autoindex/footer.html;
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
return 404;
}
}