Nginx+fancyindex漂亮目录浏览带搜索功能

Nginx+fancyindex漂亮目录浏览带搜索功能

更换原因
系统环境
安装所需包并下载nginx1.14.0和fancy插件
编译Nginx和fancy
更换原因
nginx自带目录索引,功能简单、样式也不好看,现在使用fancyindex插件来做索引,配上一个漂亮的主题还有搜索的功能

系统环境
系统:CentOS Linux release 7.5.1804
web:Nginx 1.14.0
fancy: fancyindex V0.4.3
fancy-theme: fancy v1.1

安装所需包并下载nginx1.14.0和fancy插件

$ yum install gcc gcc-c++ wget ntpdate vim-enhanced autoconf automake openssl-devel pcre-devel unzip
$ wget http://nginx.org/download/nginx-1.14.0.tar.gz
$ wget -O fancyindex.zip https://github.com/aperezdc/ngx-fancyindex/archive/v0.4.3.zip
$ wget -O fancytheme.zip https://github.com/Naereen/Nginx-Fancyindex-Theme/archive/master.zip
$ tar -zxvf nginx-1.14.0.tar.gz
$ unzip fancyindex.zip
$ unzip fancytheme.zip

编译Nginx和fancy

$ cd nginx-1.14.0
$ ./configure --prefix=/usr/local/nginx --add-module=../ngx-fancyindex-0.4.3/
//确定没有错误后,执行make && make install
$ make && make install
$ ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
$ mv /root/Nginx-Fancyindex-Theme-master/fancyindex.conf /usr/local/nginx/conf/
$ mv /root/Nginx-Fancyindex-Theme-master/Nginx-Fancyindex-Theme-dark/ /usr/local/nginx/html/fancydark
$ vim /usr/local/nginx/conf/nginx.conf

nginx.conf配置文件 把fancyindex.conf包含到location /中

worker_processes 1;

events {
worker_connections 1024;
}


http {


include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

server {
 listen 80;
 server_name 192.168.244.131;

 location / {
 root html;
 include fancyindex.conf;
 }

 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
 root html;
 }

 }

}

以上是nginx.conf 配置文件

下面来看/usr/local/nginx/fancyindex.conf

fancyindex on;
fancyindex_localtime on;
fancyindex_exact_size off;
fancyindex_header "/fancydark/header.html";
fancyindex_footer "/fancydark/footer.html";
fancyindex_ignore "fancydark";
fancyindex_name_length 255;

以上是fancyindex.conf

下面让我们来启动nginx

$ rm -rf /usr/local/nginx/html/index.html
$ nginx

————————————————
版权声明:本文为CSDN博主「lucas3306」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/cp_zhong/article/details/84066892

posted @   peterjiang520  阅读(319)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示