nginx展示目录及美化
1.下载nginx
2.下载fancyindex
git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
3.下载主题
git clone https://github.com/lanffy/Nginx-Fancyindex-Theme.git
编译安装
./configure --prefix=/usr/local/nginx --add-module=../ngx-fancyindex/
make && make install
mv /root/Nginx-Fancyindex-Theme /usr/local/nginx/html/
nginx配置
location /download{
include /usr/local/Cellar/nginx/1.12.2_1/html/Nginx-Fancyindex-Theme/fancyindex.conf; # 目录美化配置
alias /Users/mac-desktop/video/; #指定目录所在路径
autoindex on; #开启目录浏览
autoindex_format html; #以html风格将目录展示在浏览器中
autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB
autoindex_localtime on; #以服务器的文件时间作为显示的时间
charset utf-8,gbk; #展示中文文件名
}
效果如下
或者不使用主题
location / {
alias /data/;
fancyindex on; # 使用fancyindex
fancyindex_exact_size off; # 不显示精确大小
}
效果如下
作者:Outsrkem
原文链接:https://www.cnblogs.com/outsrkem/p/11206648.html
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
请我喝杯咖啡吧
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步