Autoindex module extension

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”

Hello!

On Mon, Feb 06, 2012 at 08:15:59PM +0400, Max wrote:

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.

There are no plans to extend autoindex with various
customizations. Instead, we’ll likely provide xml index to make
arbitrary customization via xslt possible.

Maxim D.

06 февраля 2012, 21:00 от Maxim D. [email protected]:

On Mon, Feb 06, 2012 at 08:15:59PM +0400, Max wrote:

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.

There are no plans to extend autoindex with various
customizations. Instead, we’ll likely provide xml index to make
arbitrary customization via xslt possible.

Then could you maybe add my extension to the list of 3rd party
modules and patches?

You can find the patch and the documentation here:

NGiNXYZ NGiNX Autoindex Module Extension
http://nginxyzpro.berlios.de/nginxyz_nginx_autoindex_module_extension/

Max

08 февраля 2012, 04:31 от Maxim D. [email protected]:

arbitrary customization via xslt possible.
may update yourself if you feel it’s usable for others.
I have updated the wiki to include my extension:
NGINX 3rd Party Modules | NGINX

(You may also want to look at fancy index 3rd party module, which is
expected to cover most of customization needs as of now. See
http://wiki.nginx.org/NgxFancyIndex.)

I’m familiar with that module, but it doesn’t provide the features
my extension provides, which is why I wrote my extension.
While the fancy_index_header directive could be used to include
a customized header file to omit the “Index of” string in the title
and in the header (which is what my autoindex_omit_index_of
directive does), there is no way to customize the displayed
directory name with the fancy index module, it always displays
the URI, unlike my autoindex_dirname_to_display directive, which
can be set to display anything, including variables, instead of
the standard URI-based “Index of /directory/subdirectory/” string.

Max

Hello!

On Wed, Feb 08, 2012 at 01:49:39AM +0400, Max wrote:

arbitrary customization via xslt possible.

Then could you maybe add my extension to the list of 3rd party
modules and patches?

You can find the patch and the documentation here:

NGiNXYZ NGiNX Autoindex Module Extension
Adminpanel

The only list of 3rd party modules we have is in wiki, which you
may update yourself if you feel it’s usable for others.

(You may also want to look at fancy index 3rd party module, which is
expected to cover most of customization needs as of now. See
http://wiki.nginx.org/NgxFancyIndex.)

Maxim D.