一、开启全站目录浏览功能

编辑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;  # 避免中文乱码

 

相关文章:

  • 2022-12-23
  • 2021-08-07
  • 2022-01-15
  • 2022-12-23
  • 2021-08-14
  • 2021-09-02
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-12-20
  • 2022-01-29
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案