- A+
所属分类:未分类
更换原因
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
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫