ngx_fancyindex
nginx模块安装工具
先进入t文件夹
./build-and-run
要求传入参数version
进入nginx的sbin
./nginx -v
大写V可以查看已编译参数,小写v查看版本号
得到nginx的版本号
回到t文件夹。
./build-and-run 1.14.1
回车开始下载对应版本的模块包
下载完毕后返回上层目录。与t同级目录下
生成了对应版本号的nginx模块目录。
进入nginx-1.14.1/目录
./configure --with=。。。。。。
即可编译制定模块
编译完成后make即可
运行make后运行make install会覆盖原有模块!!!
示例:
./configure --user=www --group=www --add-module=…/ngx-fancyindex/ --prefix=/home/nginx --with-http_stub_status_module --with-http_ssl_module
其中–add-module指定ngx-fancyindex的目录,就是当前操作的上层文件夹,最好用绝对路径
–prefix指定编译完成的文件存放目录。可以省略。
从git下载索引主题
git clone https://github.com/Naereen/Nginx-Fancyindex-Theme.git
执行过后会在当前目录冒出来一个Nginx-Fancyindex-Theme
将这个目录下的Nginx-Fancyindex-Theme-dark或(light)目录复制到网站目录
然后修改nginx的配置文件
在nginx目录下(sbin目录同级)进入conf目录打开nginx.conf配置文件。
在http下插入以下代码。检查其中html指向。修改路径即可。
fancyindex on;
fancyindex_exact_size off;
fancyindex_localtime on;
fancyindex_header “/Nginx-Fancyindex-Theme-dark/header.html”;
fancyindex_footer “/Nginx-Fancyindex-Theme-dark/footer.html”;
fancyindex_ignore “examplefile.html”;
fancyindex_ignore “Nginx-Fancyindex-Theme-dark”;
fancyindex_name_length 255;
参考:简书https://www.jianshu.com/p/ae73ee2bbe6e