码迷,mamicode.com
首页 > 其他好文 > 详细

nginx展示目录及美化

时间:2019-07-18 13:53:46      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:root   技术   desktop   log   module   download   add   clu   png   

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展示目录及美化

标签:root   技术   desktop   log   module   download   add   clu   png   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!