【nginx】索引目录

1.    ngx_http_autoindex_module

                   详情见官网 NGINX

 

      ngx_http_autoindex_module 模块 处理 以  斜线(/)结尾的请求,生成一个目录列表 。通常  当 ngx_http_autoindex_module  模块 找不到 index 文件时 ,请求传递给 ngx_http_autoindex_module 模块处理 。

   

    指令: 


autoindex : 开启或者禁用 目录列表输出功能

语法: 	autoindex on | off;
默认: 	autoindex off;
环境: 	http, server, location


autoindex_exact_size :对于 HTML 输出格式,指定是否准确的输出文件的大小

语法: 	autoindex_exact_size on | off;
默认: 	autoindex_exact_size on;
环境: 	http, server, location


autoindex_format: 设置目录列表的输出格式

语法: 	autoindex_format html | xml | json | jsonp;
默认: 	autoindex_format html;
环境: 	http, server, location
命令在 1.7.9 版本出现


autoindex_localtime:对于 HTML 输出格式,指定 目录列表中 时间是否以  本地时区显示还是 UTC

语法: 	autoindex_localtime on | off;
默认: 	autoindex_localtime off;
环境: 	http, server, location

2. 实践

  安装好 nginx 之后 ,修改 nginx 的配置文件 nginx.conf

添加如下  server

	server {
	    listen      84;
		location / {
		   root d:/workspace;
		   autoindex on;
		   autoindex_exact_size off;  
		   autoindex_localtime on;
		   autoindex_format html;  
		}
	}

开启 nginx : start nginx  |  nginx

浏览器访问 : localhost:84   即可 索引出  D 盘符下 workspace 目录下的目录。

















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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值