Project

General

Profile

Mod dirlisting » History » Revision 32

Revision 31 (gstrauss, 2017-02-27 00:07) → Revision 32/40 (gstrauss, 2017-02-27 05:27)

{{>toc}} 

 h1. Module mod_dirlisting - Directory Listings 

 h2. Description 

 A directory listing is generated if a directory is requested and no index-file was found in that directory. 

 To enable directory listings globally: 

    dir-listing.activate = "enable" 

 If you need it only for a specific directory or directories, use conditionals: 

    $HTTP["url"] =~ "^/download($|/)" { 
      dir-listing.activate = "enable" 
    } 

 You can also use an external generator for directory listings if you use mod_indexfile. 

    index-file.names = ( "/dir-generator.php" ) 

 For those with an old config file, the obsolete value is: 

    server.indexfiles = ( "/dir-generator.php" ) 

 If a directory is requested, the dir-generator.php is called instead which can take the REQUEST_URI to see which directory was requested. 
 For large folders this is highly recommended.    *Note* that the target dir-generator path must exist in the filesystem, or else mod_indexfile will skip it.    (In other words, the dir-generator must exist, even as an empty file, for mod_indexfile even if the target is handled by mod_fastcgi or mod_scgi and configured with "check-local" => "disable") 


 The dir-generator.php file can be found at the bottom of this document or at: 

 <pre>http://www.archerseven.com/kittykatt/index.php?page=scripts&sub=lighttpdlisting</pre> 



 h2. Options 

 h3. dir-listing.activate 

 enables virtual directory listings if a directory is requested no index-file was found.  
 default value: disable 

 h3. dir-listing.hide-dotfiles 

 if enabled, does not list hidden files in directory listings generated by the dir-listing option. 
 default value: disable 

 h3. dir-listing.external-css 

 path to an external css stylesheet for the directory listing. 

 h3. dir-listing.external-js 

 path to an external js script, e.g. for client side directory list sorting (lighttpd 1.4.42) 

 h3. dir-listing.exclude 

 list of regular expressions. Files that match any of the specified regular expressions will be excluded from directory listings. 

 Use inside of conditionals was broken before 1.4.14. See #1260. 

 h3. dir-listing.encoding 

 set a encoding for the generated directory listing. 

 If your file-system is not using ASCII you have to set the encoding of the filenames as they are put into the HTML listing AS IS (with XML encoding). 

 Example: 

    dir-listing.encoding = "utf-8" 

 default value: 

    dir-listing.encoding = "iso-8859-1" 

 h3. dir-listing.show-readme 

 show the contents of the README.txt file after the directory listing. 
 (since 1.4.43, can be user-specified filename instead of README.txt) 
 default value: disable 

 h3. dir-listing.hide-readme-file 

 hide README.txt files from the directory listing. 
 default value: disable 

 h3. dir-listing.show-header 

 show the contents of the HEADER.txt file before the directory listing. 
 (since 1.4.43, can be user-specified filename instead of HEADER.txt) 
 default value: disable 

 h3. dir-listing.hide-header-file 

 hide HEADER.txt files from the directory listing. 
 default value: disable 

 h3. dir-listing.set-footer 

 displays a string in the footer of a listing page. 
 default value: "<PACKAGE_NAME>/<PACKAGE_VERSION>" ie. "lighttpd/1.4.18" 



 h4. The following 3 options are currently available as of 1.4.23: 


 h3. dir-listing.encode-header 

 this option is a boolean. 
 It gives the ability to provide a valid html file as HEADER.txt, this file is just printed before the actual listing. See also dir-listing.encode-readme. 
 default value: enable 

 h3. dir-listing.encode-readme 

 this option is a boolean. 
 It gives the ability to provide a valid html file as README.txt, this file is just printed after the actual listing. See also dir-listing.encode-header. 
 default value: enable 

 h3. dir-listing.auto-layout 

 this option is a boolean. 
 When disabled, it will remove the html part lighttpd was automatically outputing as the start of the page and the end (from <DOCTYPE to <body> and </body></html>). This lets the possibility to take care of those parts in the header and readme files. 
 default value: enable 

 h2. Table sorting 

 Since lighttpd 1.4.42, a default set of javascript is included to enable directory listing table sorting (as long as <code>dir-listing.auto-layout = "enable"</code>, the default, and as long as the javascript is not replaced by custom code specified by<code>dir-listing.external-js</code>). 

 A partial implementation of Apache autoindex request query arguments (https://httpd.apache.org/docs/current/en/mod/mod_autoindex.html) are available to influence how the table of directory contents is initially sorted. 

 If query string is supplied in the URL request for the dir-listing, allow specifying initial column to sort 
 * ?C=N name (default) 
 * ?C=M last-modified, then by name 
 * ?C=S size, then by name 
 * ?C=T type, then by name 
 * ?C=D type, then by name 

 and O=[AD] can be added for descending or ascending order, e.g. 
 * ?C=N&O=D descending (default) 
 * ?C=N&O=A ascending