一、开启全站目录浏览功能
编辑nginx.conf, 在http下面添加以下内容:

autoindex on;  # 开启目录文件列表
autoindex_exact_size on;  # 显示出文件的确切大小,单位是bytes
autoindex_localtime on;  # 显示的文件时间为文件的服务器时间
charset utf-8,gbk,gb2312;  # 避免中文乱码
add_header Content-Disposition attachment;  # 文件下载(可以不开启该功能)

二、开启网站部分目录浏览功能
编辑nginx.conf ,在server {} 模块或者 localtion 模块下加入以下内容:

autoindex on;  # 开启目录文件列表
autoindex_exact_size on;  # 显示出文件的确切大小,单位是bytes
autoindex_localtime on;  # 显示的文件时间为文件的服务器时间
charset utf-8,gbk,gb2312;  # 避免中文乱码

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

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

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