1、autoindex
- 将页面文件以目录的方式呈现,用于当访问的文件找不到的时候
- 常用于自建yum仓库
- autoindex可以用在http、server、location任意曾使用
location / {
autoindex on;
}
编辑-配置文件
[root@nginx conf.d]# vim /etc/nginx/conf.d/test.conf
server {
listen 80;
server_name www.test-01.org;
root /code/test;
location / {
index index.html;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;
}
}
加载配置文件
[root@nginx conf.d]# systemctl reload nginx.service
[root@nginx test]# rm -rf index.html
[root@nginx test]# mkdir test-0{1..10}
浏览器访问测试-查看效果