autoindex for Nginx, 美化默认目录文件索引页

2017-07-07 13:08:30 +08:00
 ajan

求 start ~

autoindex

autoindex for Nginx, 美化 Nginx 默认的目录文件 索引页, 支持简单响应式, 支持切换是否新窗口打开(点击底部 autoindex)


配置方法:

  1. 复制 .autoindex 目录至 D:\websites\fulicat
    ps: D:\websites\fulicat\.autoindex

  2. 修改 nginx.conf 文件

# fulicat.bz
server {
    listen          80;
    server_name     fulicat.bz;
    root            D:\websites\fulicat;

    location / {
        index index.html index.htm index.php;
    }

    # autoindex for nginx
    location ~ ^(.*)/$ {
        autoindex       on;
        autoindex_localtime on;
        autoindex_exact_size off;

        #add_before_body /.autoindex/header.html;
        add_after_body /.autoindex/footer.html;
    }

    location ~ \.php$ {
        fastcgi_pass        127.0.0.1:9000;
        fastcgi_index       index.php;
        fastcgi_param       SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include             fastcgi_params;
    }
}

Screenshots:

before:

after:

12257 次点击
所在节点    分享创造
14 条回复
beginor
2017-07-07 13:24:26 +08:00
👍
shiji
2017-07-07 13:29:24 +08:00
我一直用一个叫 apaxy 的主题
ajan
2017-07-07 13:38:22 +08:00
@shiji #2 我没用过这个,我的这个只是利用 nginx 的 add_after_body 向索引页追加一段代码,对页面进行简单的处理,没文件图标,没有排序。有兴趣的可以自行修改升级。

默认的都的文件列表太拥挤了,看着眼睛好累,也不支持在新窗口打开。也不支持移动端~
wonpn
2017-07-07 13:39:28 +08:00
支持
Leonn
2017-07-07 13:41:37 +08:00
所以 github 地址呢,,
wellsc
2017-07-07 13:48:36 +08:00
不错
ajan
2017-07-07 13:48:44 +08:00
@Leonn #5 补上了
wireshark
2017-07-07 13:48:56 +08:00
ajan
2017-07-07 13:52:36 +08:00
@wireshark #8 也挺好的,我的这个优势是不需要 PHP
msg7086
2017-07-11 05:16:33 +08:00
用 h5ai 的只有我一个?
ajan
2017-07-11 07:15:08 +08:00
@msg7086 我以前用过 😄
wsph123
2017-07-14 11:11:45 +08:00
感觉按照这个思路甚至可以加上翻页 排序 甚至搜索 预览🤣
ajan
2017-07-14 11:16:27 +08:00
@wsph123 #12 翻页可能没啥意义,排序,搜索,预览还是可以扩展的
pxw2002
2019-03-07 11:58:15 +08:00
有办法隐藏文件时间吗 谢谢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/373700

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX