NgxFancyIndex是一个nginx的插件,用来实现自定义的目录列表页头和页脚,NgxFancyIndex的使用方法:http://wiki.nginx.org/NginxNgxFancyIndex。

NgxFancyIndex的安装方法网上有很多教程,大多数是在编译nginx时,增加这个插件。

使用apt-get install nginx安装的,请先安装nginx-extras,这里面包含有一些常用的插件。

设置如下:

server {
    listen       80;
    server_name  www.test.com;
    index index.html index.php index.html;
    root /var/www/www.test.com;
    #打开nginx列表功能
    autoindex on;
    #显示列表文件大小
    autoindex_exact_size off;
    #显示列表文件时间
    autoindex_localtime on;
    location / {   
        location / {
            fancyindex on;
            fancyindex_exact_size off;
            fancyindex_localtime on;
            fancyindex_header "myheader.html";
            fancyindex_footer "myfooter.html";
            fancyindex_css_href "my_html.css"
        }
    }
    access_log  /var/log/nginx/www.test.com.log;
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注