您的位置:首页 > 运维架构 > Nginx

nginx索引目录配置

2015-09-05 20:22 423 查看
为了简单共享文件,有些人使用svn,有些人使用ftp,但是更多得人使用索引(index)功能。apache得索引功能强大,并且也是最常见得,nginx得auto_index实现得目录索引偏少,而且功能非常简单。先来看看我们得效果图。




nginx auto_index索引效果图

nginx配置

1
2
3
4
5

location ~ ^/2589(/.*)
{
autoindex on; //开启
autoindex_localtime on;//开启显示功能
}

auto_index指令

语法:
autoindex 
on
| [code]off
;[/code]
配置段:
1

autoindex off;

配置段:
http
,
server
,
location
启用/仅用nginx目录索引功能.

语法:
autoindex_exact_size 
on
| [code]off
;[/code]
配置段
1

autoindex_exact_size on;

配置段:
http
,
server
,
location
制定是否额外得显示文件得大小,单位为字节,mb,gb等等. 默认是打开得

syntax:
autoindex_localtime 
on
| [code]off
;[/code]
配置段:
1

autoindex_localtime off;

配置段:
http
,
server
,
location
指定是否显示目录或者文件得时间,默认是不显示

可以发现nginx的索引功能非常单一,比apache的差远了。有很多nginx的爱好者就看不过去了,开发了一个漂亮的索引插件,名叫fancy index. 请继续关注下节内容nginx+fancy实现漂亮的索引目录
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: