Welcome! Log In Create A New Profile

Advanced

Autoindex module extension [patch]

All files from this thread

File Name File Size   Posted by Date  
7.2 KB open | download Max 02/06/2012 Read message
Max
February 06, 2012 11:18AM
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"
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Attachments:
open | download - (7.2 KB)
Subject Author Posted

Autoindex module extension [patch] Attachments

Max February 06, 2012 11:18AM

Re: Autoindex module extension [patch]

Maxim Dounin February 06, 2012 12:02PM

Re[2]: Autoindex module extension [patch]

Max February 07, 2012 04:50PM

Re: Autoindex module extension [patch]

Maxim Dounin February 07, 2012 07:32PM

Re[2]: Autoindex module extension [patch]

Max February 08, 2012 12:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready