nginx启动目录索引


How to enable automatic Nginx directory index listings

location /somedirectory/ {
    autoindex on;
}


还有些其它相关可配置:
Besides simply using autoindex on or off, there are also three other directives you can configure with this module. These include the following:

  • autoindex_exact_size; - 最大文件数量,This directive specifies whether Nginx should display the exact file sizes of the output in the directory index or simply round to the nearest KB, MB, or GB. This directive has two options: on or off.
  • autoindex_format; -指令directive指定索引列表输出的格式, This directive specifies what format the Nginx index listing should be outputted to. This directive has four options: html, xml, json, or jsonp.
  • autoindex_localtime; - This directive specifies whether the times for the directory listing should be outputted to local time or UTC. This directive has two options: on or off.
An example of a location directive using all four autoindex options could resemble the following.

location /somedirectory/ {
    autoindex on;
    autoindex_exact_size off;
    autoindex_format html;
    autoindex_localtime on;
}
阅读量: 402
发布于:
修改于: