使用 NgxFancyIndex 代替nginx原有的autoindex模块美化文件显示
2015-07-06 14:18
1256 查看
http://wiki.nginx.org/NginxNgxFancyIndex
(Redirected from
NginxNgxFancyIndex)
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, or size; both ascending (default), or descending (new in 0.3.3).
This module is designed to work with nginx, a high performance open source web server written by Igor Sysoev.
Note: I have compiled this module with nginx-1.0.10 on a server running Debian Squeeze - however the README only talks about nginx-0.8
The module compiles with 0.7.x versions as well.
It _might_ compile with 0.6.x applying "nginx-0.6-support.patch", YMMV.
Patience, and some Coffee™.
2. Download the latest version using Git:
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:
4. Build and install the software::
And then, as ``root``::
5. Configure Nginx_ by using the modules' configuration directives_.
fancyindex_css_href
Syntax: *fancyindex_css_href uri*Default: fancyindex_css_href ""Context: http, server, locationDescription:
fancyindex_exact_size
Syntax: *fancyindex_exact_size* [*on* | *off*]Default: fancyindex_exact_size onContext: http, server, locationDescription:
... warning:
fancyindex_localtime
Syntax: *fancyindex_localtime* [*on* | *off*]Default: fancyindex_localtime offContext: http, server, locationDescription:
(Redirected from
NginxNgxFancyIndex)
Contents1Synopsis 2 Requirements 3 Building 4 Example Enable 5 Directives 5.1 fancyindex 5.2 fancyindex_css_href 5.3 fancyindex_exact_size 5.4 fancyindex_footer 5.5 fancyindex_header 5.6 fancyindex_ignore 5.7 fancyindex_localtime |
Synopsis
The Fancy Index module makes possible the generation of file listings, like the built-in autoindex module does, but adding a touch of style. This is possible because the module module allows 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, or size; both ascending (default), or descending (new in 0.3.3).
This module is designed to work with nginx, a high performance open source web server written by Igor Sysoev.
Note: I have compiled this module with nginx-1.0.10 on a server running Debian Squeeze - however the README only talks about nginx-0.8
Requirements
Sources for Nginx_ 0.8.x, and its requirements.The module compiles with 0.7.x versions as well.
It _might_ compile with 0.6.x applying "nginx-0.6-support.patch", YMMV.
Patience, and some Coffee™.
Building
1. Unpack the Nginx_ sources::$ gunzip -c nginx-?.?.?.tar.gz | tar -xvf -
2. Download the latest version using Git:
$ git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
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=../ngx-fancyindex [extra desired options]
4. Build and install the software::
$ make
And then, as ``root``::
# make install
5. Configure Nginx_ by using the modules' configuration directives_.
Example Enable
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. }
Directives
fancyindex
Syntax: *fancyindex* [*on* | *off*]Default: fancyindex offContext: http, server, locationDescription:Enables or disables fancy directory indexes.
fancyindex_css_href
Syntax: *fancyindex_css_href uri*Default: fancyindex_css_href ""Context: http, server, locationDescription:Allows inserting a link to a CSS style sheet in generated listings. The provided *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 the default styles.
fancyindex_exact_size
Syntax: *fancyindex_exact_size* [*on* | *off*]Default: fancyindex_exact_size onContext: http, server, locationDescription:Defines how to represent file sizes in the directory listing; either accurately, or rounding off to the kilobyte, the megabyte and the gigabyte.
fancyindex_footer
Syntax: *fancyindex_footer path*Default: fancyindex_footer ""Context: http, server, locationDescription: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 will be sent.
... warning:
When inserting custom header/footer a subrequest will be issued so potentially any URL can be used as source for them. Although it will work with external URLs, only using internal ones is supported. External URLs are totally untested and using them will make Nginx_ block while waiting for the subrequest to complete. If you feel like external header/footer is a must-have for you, please `let me know <mailto:aperez@igalia.com>`__.
fancyindex_header
Syntax: *fancyindex_header path*Default: fancyindex_header ""Context: http, server, locationDescription: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 will be sent.
fancyindex_ignore
Syntax: *fancyindex_ignore string1 [string2 [... stringN]]*Default: No default.Context: http, server, locationDescription:Specifies a list of file names which will be not be shown in generated listings. If Nginx was built with PCRE support strings are interpreted as regular expressions.
fancyindex_localtime
Syntax: *fancyindex_localtime* [*on* | *off*]Default: fancyindex_localtime offContext: http, server, locationDescription:Enables showing file times as local time. Default is “off” (GMT time).
相关文章推荐
- Nginx打开目录浏览功能(autoindex)
- 记vagrant nginx sendfile问题
- nginx 跨域acl
- 从nginx日志中统计nginx缓存命中率
- nginx+lua_nginx+GraphicsMagick缩略图+tfs获取原图+ngx_cache_purge
- Nginx学习之keepalive
- Nginx列出目录和文件并用密码控制访问权限配置方法
- nginx服务器下编写cgi程序
- nginx-lua-fastdfs-GraphicsMagick整合
- Nginx 1.9.2新特性
- Nginx入门
- (LNMP) How To Install Linux, nginx, MySQL, PHP
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
- 我的 Fedora 20 + django + nginx + uwsgi 配置
- nginx 显示文件目录
- [Linux] Nginx networking 403 Forbidden 静态文件不允许查看
- Fedora20 + Nginx + uWSGI + Django环境下访问静态文件可能遇到的问题
- Fedora20 + Nginx + uWSGI + Django环境的搭建
- 让Nginx处理Django的静态文件
- [转]nginx 源码学习笔记(十五)—— ngx_master_process_cycle 多进程(一)