参考文档:官方帮助
[root@tokyo home]# wget http://nginx.org/download/nginx-1.10.1.tar.gz
[root@tokyo home]# git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
[root@tokyo home]# gunzip -c nginx-1.10.1.tar.gz | tar -xvf -
[root@tokyo home]# cd nginx-1.10.1
[root@tokyo nginx-1.10.1]# ./configure --prefix=/usr/local/nginx/ --add-module=../ngx-fancyindex
[root@tokyo nginx-1.10.1]# make & make install
[root@tokyo nginx-1.10.1]# vim /usr/local/nginx/conf/vhost/dl.lianst.com.conf
.....
location / {
fancyindex on; # 开启fancy目录索引
fancyindex_exact_size off; # 不使用精确大小.
fancyindex_localtime on; #使用本地时间
#fancyindex_header ".heard.html"; #使用.heard.html作为头部文件,没有这个文件将会出现404错误.
fancyindex_footer "/.footer.html"; #使用.footer.html作为底部文件,没有这个文件将会出现404错误.
#fancyindex_css_href "fancyindex/css";
}
[root@tokyo nginx-1.10.1]# lnmp restart
效果如下: