首页 > 其他 > 详细

nginx展示目录及美化

时间:2019-07-18 13:38:31      阅读:153      评论:0      收藏:0      [点我收藏+]

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; # 不显示精确大小
        }

效果如下

技术分享图片

nginx展示目录及美化

原文:https://www.cnblogs.com/outsrkem/p/11206648.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!