AutoIndex#
Serves requests ending with a slash (/) and produces a directory listing. Usually, a request is passed to the AutoIndex module when the Index module cannot find an index file.
When building from the source code, the module is built by
default; it can be disabled with the build option
--without-http_autoindex_module.
In packages and images from our repositories, the
module is included in the build. Enables or disables the directory listing output. For the HTML format, specifies whether exact file sizes should be output in the directory listing, or rather rounded to kilobytes, megabytes, and gigabytes. Default http, server, location Sets the format of a directory listing. When the JSONP format is used, the name of a callback function is set with the The XML output can be transformed using the XSLT module. Output Formats Object fields in responses contain the following data: Field Description File or directory name Object type: Object size according to autoindex_exact_size;
for directories — Last modification time in Unix time format For the HTML format, specifies whether times in the directory listing should be output in the local time zone or UTC.Configuration Example#
location / {
autoindex on;
}
Directives#
autoindex#
autoindex_exact_size#
autoindex_format#
autoindex_format html | xml | json | jsonp;autoindex_format html;callback request argument. If the argument is missing or has an empty value, then the JSON format is used.nametypefile or directorysize0mtime<html>
<head>
<title>Index of /files/</title>
</head>
<body>
<h1>Index of /files/</h1>
<hr>
<pre>
<a href="../">../</a>
<a href="example.txt">example.txt</a> 12-Jun-2025 14:21 1234
<a href="image.png">image.png</a> 12-Jun-2025 14:21 4321
</pre>
<hr>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<listing>
<file>
<name>example.txt</name>
<type>file</type>
<size>1234</size>
<mtime>2025-06-12T14:21:00Z</mtime>
</file>
<file>
<name>image.png</name>
<type>file</type>
<size>4321</size>
<mtime>2025-06-12T14:21:00Z</mtime>
</file>
</listing>
[
{
"name": "example.txt",
"type": "file",
"size": 1234,
"mtime": "2025-06-12T14:21:00Z"
},
{
"name": "image.png",
"type": "file",
"size": 4321,
"mtime": "2025-06-12T14:21:00Z"
}
]
callback([
{
"name": "example.txt",
"type": "file",
"size": 1234,
"mtime": "2025-06-12T14:21:00Z"
},
{
"name": "image.png",
"type": "file",
"size": 4321,
"mtime": "2025-06-12T14:21:00Z"
}
]);
autoindex_localtime#