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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?