Autoindex module extension [patch]
Max
nginxyz at mail.ru
Mon Feb 6 16:15:59 UTC 2012
Hello,
I have written an extension for the Autoindex module that adds
two new directives. I've included the patch against the latest
1.1.14 version of nginx, as well as the documentation for the
Wiki.
Max
autoindex_omit_index_of
syntax: autoindex_omit_index_of [on|off]
default: off
context: http, server, location
variables: no
version: >= 1.1.14
This directive determines whether the "Index of " string is displayed
in the title and in the header of a directory listing. It takes one
argument (a boolean flag), and is set to off by default, so "Index of "
is displayed as usual.
autoindex_dirname_to_display
syntax: autoindex_dirname_to_display <directory_name_string>;
default: none
context: http, server, location
This directive determines the directory name to display next
to the "Index of " string in the title and in the header of a
directory listing. It takes one argument (a string), which can
contain variables. This directive can also be used to remove
trailing slashes from a directory pathname.
location ~ ^/internal/([^/]+)(|/.*)$ {
internal;
set $dir "$1 :: $2";
autoindex on;
autoindex_omit_index_of on;
autoindex_dirname_to_display "-==[ NGiNX & Co :: $dir ]==-";
alias /mnt/nfs/server123/$1/$2;
}
The example above demonstrates how to display the directory contents
of /mnt/nfs/server123/$1/$2 while omitting the "Index of " string,
and displaying the following customized string instead of the
"Index of /internal/$1/$2/" string in the title and in the header
of the directory listing:
"-==[ NGiNX & Co :: $1 :: $2 ]==-"
location ~ ^/internal/~([^/]+)/(|.*)$ {
internal;
autoindex on;
autoindex_dirname_to_display "nfs:/home/$1/public_html/$2";
alias /mnt/nfs/server123/$1/$2;
}
The example above demonstrates how to display the directory contents
of /mnt/nfs/server123/$1/$2 using the following customized string
instead of the "Index of /internal/~$1/$2" string in the title and
in the header of the directory listing:
"Index of nfs:/home/directory/$1/public_html/$2"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-dirname_to_display-omit_index_of-ngx_http_autoindex_module.c.20120206.diff
Type: application/octet-stream
Size: 7349 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120206/f0abb30c/attachment.obj>
More information about the nginx
mailing list