dir listing 目录文件列表索引

一般而言,网站应用都有一个入口,比如说:index.php,index.html,app.js等。通过这个路口,以及相应的路由功能,去到网站各个功能版块。
而网站的目录结构,目录里面的文件列表,一般都是对用户规避的。原因有两个:一个是安全,另一个是跟业务无关。

所以一般情况下,我们很难看到目录结构,如果需要做dir listing,需要做一些配置。
就apache而言,首先要启用 httpd-autoindex模块。然后再 httpd.conf --> Directory 配置中,加上 indexes的配置项

<Directory />
    Options FollowSymLinks Indexes
    #AllowOverride None
    AllowOverride All
    Order deny,allow
    allow from all
</Directory>

就nginx而言,需要添加autoindex:on的配置

server {
        listen   80;
        server_name  domain.com www.domain.com;
        access_log  /var/...........................;
        root   /path/to/root;
        location / {
                index  index.php index.html index.htm;
        }
        location /somedir {
               autoindex on;
        }
}

Ref

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值