• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ngx-fancyindex-module: Fancy Index module makes possible the generation of file ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ngx-fancyindex-module

开源软件地址:

https://gitee.com/wupz/ngx-fancyindex-module

开源软件介绍:

Nginx Fancy Index module

Build Status

The Fancy Index module makes possible the generation of file listings, likethe built-in autoindexmodule does, but adding a touch of style. This is possible because the moduleallows a certain degree of customization of the generated content:

  • Custom headers. Either local or stored remotely.
  • Custom footers. Either local or stored remotely.
  • Add you own CSS style rules.
  • Allow choosing to sort elements by name (default), modification time, orsize; both ascending (default), or descending.

This module is designed to work with Nginx, a high performance open source webserver written by Igor Sysoev.

Requirements

CentOS 7

For users of the official stable Nginx repository, extra packages repository with dynamic modules is available and fancyindex is included.

Install directly:

yum install https://extras.getpagespeed.com/redhat/7/x86_64/RPMS/nginx-module-fancyindex-1.12.0.0.4.1-1.el7.gps.x86_64.rpm

Alternatively, add extras repository first (for future updates) and install the module:

yum install nginx-module-fancyindex

Then load the module in /etc/nginx/nginx.conf using:

load_module "modules/ngx_http_fancyindex_module.so";

Other platforms

In most other cases you will need the sources for Nginx. Any version starting from the 0.7series onwards will work. Note that the modules might compile withversions in the 0.6 series by applying nginx-0.6-support.patch, but thisis unsupported (YMMV).

In order to use the fancyindex_header_ and fancyindex_footer_ directivesyou will also need the ngx_http_addition_modulebuilt into Nginx.

Building

  1. Unpack the Nginx sources:

    $ gunzip -c nginx-?.?.?.tar.gz | tar -xvf -
  2. Unpack the sources for the fancy indexing module:

    $ gunzip -c nginx-fancyindex-?.?.?.tar.gz | tar -xvf -
  3. Change to the directory which contains the Nginx sources, run theconfiguration script with the desired options and be sure to put an--add-module flag pointing to the directory which contains the sourceof the fancy indexing module:

    $ cd nginx-?.?.?$ ./configure --add-module=../nginx-fancyindex-?.?.? \   [--with-http_addition_module] [extra desired options]

    Since version 0.4.0, the module can also be built as adynamic module,using --add-dynamic-module=… instead andload_module "modules/ngx_http_fancyindex_module.so";in the configuration file

  4. Build and install the software:

    $ make

    And then, as root:

    # make install
  5. Configure Nginx by using the modules' configuration directives.

Example

You can test the default built-in style by adding the following lines intoa server section in your Nginx configuration file:

location / {  fancyindex on;              # Enable fancy indexes.  fancyindex_exact_size off;  # Output human-readable file sizes.}

Themes

The following themes demonstrate the level of customization which can beachieved using the module:

  • Theme by@TheInsomniac. Uses custom header andfooter.
  • Theme by@Naereen. Uses custom header and footer, theheader includes search field to filter by filename using JavaScript.
  • Theme by@fraoustin. Responsive theme usingMaterial Design elements.
  • Theme by@alehaa. Simple, flat theme based onBootstrap 4 and FontAwesome.

Directives

fancyindex

Syntax:fancyindex [on | off]
Default:fancyindex off
Context:http, server, location
Description:Enables or disables fancy directory indexes.

fancyindex_default_sort

Syntax:fancyindex_default_sort [name | size | date | name_desc | size_desc | date_desc]
Default:fancyindex_default_sort name
Context:http, server, location
Description:Defines sorting criterion by default.

fancyindex_directories_first

Syntax:fancyindex_directories_first [on | off]
Default:fancyindex_directories_first on
Context:http, server, location
Description:If enabled (default setting), groups directories together and sorts thembefore all regular files. If disabled, directories are sorted together with files.

fancyindex_css_href

Syntax:fancyindex_css_href uri
Default:fancyindex_css_href ""
Context:http, server, location
Description:Allows inserting a link to a CSS style sheet in generated listings. Theprovided uri parameter will be inserted as-is in a <link> HTML tag.The link is inserted after the built-in CSS rules, so you can override thedefault styles.

fancyindex_exact_size

Syntax:fancyindex_exact_size [on | off]
Default:fancyindex_exact_size on
Context:http, server, location
Description:Defines how to represent file sizes in the directory listing; eitheraccurately, or rounding off to the kilobyte, the megabyte and thegigabyte.

fancyindex_name_length

Syntax:fancyindex_name_length length
Default:fancyindex_name_length 50
Context:http, server, location
Description:Defines the maximum file name length limit in bytes.

fancyindex_footer

Syntax:fancyindex_footer path
Default:fancyindex_footer ""
Context:http, server, location
Description:Specifies which file should be inserted at the foot of directory listings.If set to an empty string, the default footer supplied by the module willbe sent.

Note

Using this directive needs the ngx_http_addition_module builtinto Nginx.

Warning

When inserting custom header/footer a subrequest will beissued so potentially any URL can be used as source for them. Although itwill work with external URLs, only using internal ones is supported.External URLs are totally untested and using them will make Nginx blockwhile waiting for the subrequest to complete. If you feel like externalheader/footer is a must-have for you, pleaselet me know.

fancyindex_header

Syntax:fancyindex_header path
Default:fancyindex_header ""
Context:http, server, location
Description:Specifies which file should be inserted at the head of directory listings.If set to an empty string, the default header supplied by the module willbe sent.

Note

Using this directive needs the ngx_http_addition_module builtinto Nginx.

fancyindex_show_path

Syntax:fancyindex_show_path [on | off]
Default:fancyindex_show_path on
Context:http, server, location
Description:Whether to output or not the path and the closing </h1> tag after the header.This is useful when you want to handle the path displaying with a PHP scriptfor example.

Warning

This directive can be turned off only if a custom header is providedusing fancyindex_header.

fancyindex_ignore

Syntax:fancyindex_ignore string1 [string2 [... stringN]]
Default:No default.
Context:http, server, location
Description:Specifies a list of file names which will be not be shown in generatedlistings. If Nginx was built with PCRE support strings are interpreted asregular expressions.

fancyindex_hide_symlinks

Syntax:fancyindex_hide_symlinks [on | off]
Default:fancyindex_hide_symlinks off
Context:http, server, location
Description:When enabled, generated listings will not contain symbolic links.

fancyindex_hide_parent_dir

Syntax:fancyindex_hide_parent_dir [on | off]
Default:fancyindex_hide_parent_dir off
Context:http, server, location
Description:When enabled, it will not show parent directory.

fancyindex_localtime

Syntax:fancyindex_localtime [on | off]
Default:fancyindex_localtime off
Context:http, server, location
Description:Enables showing file times as local time. Default is “off” (GMT time).

fancyindex_time_format

Syntax:

fancyindex_time_format string

Default:

fancyindex_time_format "%Y-%b-%d %H:%M"

Context:

http, server, location

Description:

Format string used for timestamps. The format specifiers are a subset ofthose supported by the strftimefunction, and the behavior is locale-independent (for example, day and monthnames are always in English). The supported formats are:

  • %a: Abbreviated name of the day of the week.
  • %A: Full name of the day of the week.
  • %b: Abbreviated month name.
  • %B: Full month name.
  • %d: Day of the month as a decimal number (range 01 to 31).
  • %e: Like %d, the day of the month as a decimal number, but aleading zero is replaced by a space.
  • %F: Equivalent to %Y-%m-%d (the ISO 8601 date format).
  • %H: Hour as a decimal number using a 24-hour clock (range 00to 23).
  • %I: Hour as a decimal number using a 12-hour clock (range 01 to 12).
  • %k: Hour (24-hour clock) as a decimal number (range 0 to 23);single digits are preceded by a blank.
  • %l: Hour (12-hour clock) as a decimal number (range 1 to 12); singledigits are preceded by a blank.
  • %m: Month as a decimal number (range 01 to 12).
  • %M: Minute as a decimal number (range 00 to 59).
  • %p: Either "AM" or "PM" according to the given time value.
  • %P: Like %p but in lowercase: "am" or "pm".
  • %r: Time in a.m. or p.m. notation. Equivalent to %I:%M:%S %p.
  • %R: Time in 24-hour notation (%H:%M).
  • %S: Second as a decimal number (range 00 to 60).
  • %T: Time in 24-hour notation (%H:%M:%S).
  • %u: Day of the week as a decimal, range 1 to 7, Monday being 1.
  • %w: Day of the week as a decimal, range 0 to 6, Monday being 0.
  • %y: Year as a decimal number without a century (range 00 to 99).
  • %Y: Year as a decimal number including the century.

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap