本文共 522 字,大约阅读时间需要 1 分钟。
所使用的到的模块 autoindex
server { listen 80; server_name www.aaa.com; location / { root /html/www; #index index.html index.htm; autoindex on; #--- 开启nginx站点目录索引功能 auth_basic "pass"; auth_basic_user_file password/htpasswd; }}
这里需要注意的是:index 默认值为index.html 所以如果只是注释点index,但站点目录中还有index.html的时候还是会打开网站,无法实现目录索引的功能. mime.types支持的媒体类型,会被浏览器直接解析,无法实现下载功能
解决上传文件中文,浏览器乱码问题
可以在server标签中指定字符集
charset utf-8,gbk;
显示文件人类可读大小
autoindex_exact_size off;
转载地址:http://xhepb.baihongyu.com/