---
title: "Nginx打开目录浏览功能(autoindex)"
author: "scau_fly"
date: "2014-02-20T18:25:53Z"
tags: []
categories: ["移动开发"]
slug: "nginx-autoindex"
draft: false
lastmod: "2014-02-20T18:25:53Z"
id: 2019927
url: "https://scau-fly.iteye.com/blog/2019927"
---

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

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

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

autoindex\_localtime on;  
默认为off，显示的文件时间为GMT时间。  
改为on后，显示的文件时间为文件的服务器时间

        location ^~ /html/ {  
                autoindex on;  
                autoindex\_exact\_size on;  
                autoindex\_localtime on;  
                index 12345;#这里要设置一个无法访问的url  
                root /data/nginx-1.2.3/;  
        }

详细参照:http://wiki.**nginx**.org/NginxChsHttpAutoindexModule

 

 

http://edu.codepub.com/server/nginx/