Nginx+Fancyindex 实现索引目录
温馨提醒
简介
Fancy Index 模块可以生成文件列表,就像内置的 audoindex 模块一样,但增加了一些样式。
下载安装包
下载 Fancy Index
下载 Nginx-Fancyindex-Theme
下载 Nginx
安装 Nginx
安装 Nginx
1 2 3 4 5 6 7 8 9# 创建 nginx 用户 useradd -s /sbin/nologin nginx # 配置 cd nginx-1.26.3 ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-stream --with-pcre --with-http_gzip_static_module --with-http_realip_module --add-module=/usr/local/ngx-fancyindex # 编译安装 make && make install配置 Nginx
vim /usr/local/nginx/conf/nginx.conf1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25# user nginx; worker_processes auto; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; tcp_nopush on; keepalive_timeout 65; gzip on; include vhost/*.conf; }创建索引配置文件1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30vim /usr/local/nginx/conf/vhost/fancyindex.conf server { listen 80; server_name 172.20.10.150; location / { root /usr/local/nginx/html; # 使用 fancyindex fancyindex on; # 不显示精确大小 fancyindex_exact_size off; # 文件日期 fancyindex_time_format "%Y-%m-%d %H:%M"; # 使用用户本地时间 fancyindex_localtime on; fancyindex_header "/theme/header.html"; fancyindex_footer "/theme/footer.html"; } location /theme/ { alias /usr/local/nginx/theme/; } }拷贝主题
启动nginx
访问nginx,页面还没有进行美化

fancyindex 其他功能
| |
