# nginx.conf 配置
server {
listen 8286;
server_name 127.0.0.1;
location / {
root html;
add_header Cache-Control no-store;
index index.html index.htm;
}
location /opt {
include /usr/local/nginx/html/Nginx-Fancyindex-Theme/fancyindex.conf; # 目录美化配置
alias /opt/; # 指定目录所在路径
autoindex on; # 开启目录浏览
autoindex_format html; # 以html风格将目录展示在浏览器中
autoindex_exact_size off; # 切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB
autoindex_localtime on; # 以服务器的文件时间作为显示的时间
charset utf-8,gbk; # 展示中文文件名
}
}
说明
- 配置首页,因为后面
include中的内容必须能在 nginx 中访问到 alias必须以/结尾
# Nginx-Fancyindex-Theme 下载地址
https://github.com/lanffy/Nginx-Fancyindex-Theme.git (opens new window)