Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1353478
  • 博文数量: 145
  • 博客积分: 1440
  • 博客等级: 少尉
  • 技术积分: 2986
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-24 23:47
个人简介

我一直在走,至少还有条路,也好于无路可走…

文章分类

全部博文(145)

文章存档

2023年(1)

2017年(2)

2016年(5)

2015年(13)

2014年(13)

2013年(70)

2012年(41)

分类: LINUX

2013-03-05 12:02:03

                      Nginx打开目录浏览功能(autoindex)


Nginx默认是不允许列出整个目录的。如需此功能,
打开nginx.conf文件,在location server 或 http段中加入
autoindex on;
另外两个参数最好也加上去:


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


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


例子:
1.location /images {
                root   /var/www/nginx-default/ibugaocn;
                autoindex on;
        }
2.location /b   {
             autoindex  on;
             autoindex_exact_size  off;            #改为off后,显示出文件的大概大小,单位是kB或者MB或者GB
             autoindex_localtime on;               #显示的文件时间为文件的服务器时间
             limit_rate_after 10m;                 #10m之后下载速度为10k
             limit_rate 10k;
             alias /usr/local/nginx/html/redhat;   #别名
                   }

阅读(15386) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~