前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >重识Nginx - 08 使用ngx_http_autoindex_module实现目录浏览功能

重识Nginx - 08 使用ngx_http_autoindex_module实现目录浏览功能

作者头像
小小工匠
发布2022-10-04 17:26:18
3590
发布2022-10-04 17:26:18
举报
文章被收录于专栏:小工匠聊架构小工匠聊架构

文章目录

在这里插入图片描述
在这里插入图片描述

ngx_http_autoindex_module

https://nginx.org/en/docs/http/ngx_http_autoindex_module.html

在这里插入图片描述
在这里插入图片描述

配置

Example Configuration

代码语言:javascript
复制
location / {
    autoindex on;
}

autoindex

代码语言:javascript
复制
Syntax:	autoindex on | off;
Default:	
autoindex off;
Context:	http, server, location

Enables or disables the directory listing output.

autoindex on; 设置为on目录是可以访问的 autoindex off; 设置为off目录禁止访问,里面具体内容是可以访问的。


autoindex_exact_size

autoindex_exact_size off; 默认为on,显示出文件的确切大小,单位是bytes。 改为off后,显示出文件的大概大小,单位是kB或者MB或者GB

代码语言:javascript
复制
Syntax:	autoindex_exact_size on | off;
Default:	
autoindex_exact_size on;
Context:	http, server, location

For the HTML format, specifies whether exact file sizes should be output in the directory listing, or rather rounded to kilobytes, megabytes, and gigabytes.


autoindex_localtime

autoindex_localtime on; 默认为off,显示的文件时间为GMT时间。 改为on后,显示的文件时间为文件的服务器时间

代码语言:javascript
复制
Syntax:	autoindex_localtime on | off;
Default:	
autoindex_localtime off;
Context:	http, server, location

For the HTML format, specifies whether times in the directory listing should be output in the local time zone or UTC.


autoindex_format

代码语言:javascript
复制
Syntax:	autoindex_format html | xml | json | jsonp;
Default:	
autoindex_format html;
Context:	http, server, location
This directive appeared in version 1.7.9.

Sets the format of a directory listing.

When the JSONP format is used, the name of a callback function is set with the callback request argument. If the argument is missing or has an empty value, then the JSON format is used.


实操

在这里插入图片描述
在这里插入图片描述

访问

在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-10-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • ngx_http_autoindex_module
  • 配置
    • autoindex
      • autoindex_exact_size
        • autoindex_localtime
          • autoindex_format
          • 实操
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档