apache中显示目录列表

apache中显示目录列表
在http.conf中加入如下代码(如有虚拟主机配置,加在虚拟主机配置段内),并把主目录内的index.pho,index.html,index.htm文件删除

Alias /download “/download”
<Directory “/download”>
Options Indexes
Order allow,deny
IndexOptions Charset=UTF-8
Allow from all
</Directory>

其中“/download”是要显示文件列表的目录,参数”Options Indexes”表示启用目录浏览,”IndexOptions Charset=UTF-8″设置字符集,以消除中文乱码。

访问虚拟目录时可用”http://ip/alias”的形式,也可把主目录内的index.php或index.html文件用如下代码代替,实现用”http://ip”即可自动跳转到指定的虚拟目录,”(“count()”,60)”内的60表示跳转倒计时为60ms。
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html”>
<title>正在进入</title>
</head>
<body>
<form name=loading>
<p align=center> <font color=”#0066ff” size=”5″>正在进入,请稍等</font><font color=”#0066ff” size=”5″ face=”Arial”>……</font>
<input type=text name=chart size=46 style=”font-family:Arial; font-weight:bolder; color:#0066ff; background-color:#fef4d9; padding:0px; border-style:none;”>

<input type=text name=percent size=47 style=”color:#0066ff; text-align:center; border-width:medium; border-style:none;”>
<script>
var bar=0
var line=”||”
var amount=”||”
count()
function count(){
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+”%”
if (bar<99)
{setTimeout(“count()”,60);}
else
{
window.location = “http://www.jb51.net”;}
}</script>
</p>
</form>
</body>
</html>

nginx也可以通过如下配置:

location / {
root /data/www/file                     //指定实际目录绝对路径;
autoindex on;                            //开启目录浏览功能;
autoindex_exact_size off;            //关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b;
autoindex_localtime on;              //开启以服务器本地时区显示文件修改日期!
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值