nginx常用配置

配置文件服务器,在web上现实目录下的文件列表

相关模块 ngx_http_autoindex_module

1、概述

该模块处理以斜线(/)结尾的请求,并生成一个目录列表,如图:
在这里插入图片描述
通常,当ngx_http_index_module模块找不到index文件时,请求会被传递给ngx_http_autoindex_module模块

2、配置说明

相关配置指令:autoindex、autoindex_exact_size、autoindex_format、autoindex_localtime

2.1 autoindex

Syntax:	autoindex on | off;   #配置语法
Default:	autoindex off;    #默认值
Context:	http, server, location  #在配置文件中的位置

2.2 autoindex_exact_size

Syntax:	autoindex_exact_size on | off;
Default:	
autoindex_exact_size on;
Context:	http, server, location

2.3 autoindex_format

显示文件列表信息的格式

Syntax:	autoindex_format html | xml | json | jsonp;
Default:	
autoindex_format html;
Context:	http, server, location
This directive appeared in version 1.7.9.

html格式:
在这里插入图片描述

json格式:
在这里插入图片描述
xml格式:
在这里插入图片描述
jsonp格式:
当请求中携带callback参数时,会返回一个callback参数值同名的方法,如果callback不存在或者值为零,则按json格式处理
在这里插入图片描述

2.4 autoindex_localtime

Syntax:	autoindex_localtime on | off;
Default:	
autoindex_localtime off;
Context:	http, server, location

未完待续。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值