怎样让apache不要hp ux列出目录列表表

让apache显示目录列表的配置方法
字体:[ ] 类型:转载 时间:
本文教大家配置apache显示目录列表的方法,有需要的朋友不妨参考下
1、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"设置字符集,以消除中文乱码。
2、访问虚拟目录时可用"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:A font-weight: color:#0066 background-color:#fef4d9; padding:0 border-style:"&     &input type=text name=percent size=47 style="color:#0066 text-align: border-width: border-style:"&   &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&
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具配置Tomcat直接显示目录结构和文件列表 - liusu - ITeye技术网站
tomcat版本:apache-tomcat-6.0.20
Tomcat是直接显示目录结构和文件列表,只是在配置里面给关闭了。
关键在这里:..\apache-tomcat-6.0.20\conf\web.xml
这个文件有一段配置直接控制Tomcat是允许显示目录结构和文件列表。
&servlet-name&default&/servlet-name&
&servlet-class&org.apache.catalina.servlets.DefaultServlet&/servlet-class&
&init-param&
&param-name&debug&/param-name&
&param-value&0&/param-value&
&/init-param&
&init-param&
&param-name&listings&/param-name&
&param-value&false&/param-value&
&/init-param&
&load-on-startup&1&/load-on-startup&
&/servlet&
把listings选项改为true就可以了。
org.apache.catalina.servlets.DefaultServlet支持许多配置选项,在这个web.xml文件里面都有注释。
&!-- The default servlet for all web applications, that serves static
&!-- resources.
It processes all requests that are not mapped to other
&!-- servlets with servlet mappings (defined either here or in your own
&!-- web.xml file.
This servlet supports the following initialization
&!-- parameters (default values are in square brackets):
Debugging detail level for messages logged
by this servlet.
fileEncoding
Encoding to be used to read static resources
[platform default]
Input buffer size (in bytes) when reading
resources to be served.
Should directory listings be produced if there --&
is no welcome file in this directory?
[false] --&
WARNING: Listings for directories with many
entries can be slow and may consume
significant proportions of server resources.
Output buffer size (in bytes) when writing
resources to be served.
Is this context "read only", so HTTP
commands like PUT and DELETE are
readmeFile
File name to display with the directory
contents. [null]
sendfileSize
If the connector used supports sendfile, this
represents the minimal file size in KB for
which sendfile will be used. Use a negative
value to always disable sendfile.
useAcceptRanges
Should the Accept-Ranges header be included
in responses where appropriate? [true]
For directory listing customization. Checks localXsltFile, then
globalXsltFile, then defaults to original behavior.
localXsltFile
Make directory listings an XML doc and
pass the result to this style sheet residing
in that directory. This overrides
globalXsltFile[null]
globalXsltFile
Site wide configuration version of
localXsltFile This argument is expected
to be a physical file. [null]
可以多看看,多多益处。
浏览 11597
浏览: 111027 次
来自: 深圳
UTL_MATCH.EDIT_DISTANCE_SIMILAR ...
不知道怎么可以显示其它非tomcat目录结构
mysql没这个限制
请问tomcat会有catalina.out的限制吗?默认设置 ...apache 禁止用户浏览文件目录-apache-Php教程-壹聚教程网apache 禁止用户浏览文件目录
我们安装成功apache之后,如果你当前目录没有索引文件(index)文件,我们打开此目录时会把此目录下所有文件与文件以列表形式列出来了,下面我来给大家介绍禁止用户浏览文件目录方法。
我们可以通过修改Apache配置文件httpd.conf来实现禁止列出目录/文件列表,方法如下:
1、打开apache配置文件httpd.conf
&Directory /&
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
&/Directory&
只需要修改Options Indexes为Options None即可,注:根据PHP运行环境安装包的不同,Options Indexes也有可能是Options Indexes FollowSymLinks,一并改为Options None即可。
3、保存httpd.conf,并重启Apache即可,此时再访问http://localhost时, 报apache http 403 禁止访问错误信息
目录禁止访问方法
创建Directory块,比如禁止访问某个类库目录,可以这样实现
&Directory /var/www/www.111cn.net/inc&
&&& Order Deny,Allow
&&& Deny from all
&/Directory&
上一页: &&&&&下一页:相关内容禁止Apache显示目录文件列表_HTML/CSS_第七城市
禁止Apache显示目录文件列表
当你在浏览器输入地址:/如果你的文件根目录里有 index.html、index.php 等 Apache 中设定的默认主页时,浏览器就会显示相应页面的内容,如果没有这些页面,Apache将在浏览器中列出该目录的目录结构,目录结构包括文件根目录下的文件和子目录,给网站造成安全风险。同样当你输入一个虚拟目录的地址:/test/如果该虚拟目录下没有上述页面,浏览器也会显示该虚拟目录的目录结构,列出该虚拟目录下的文件和子目录。我们可以通过修改Apache的配置文件,来禁止 Apache 显示目录结构列表。打开httpd.conf ,来看一个目录配置:&Directory &var/www/html&&Options Indexes FollowSymLinksAllowOverride NoneOrder allow,denyAllow from all&/Directory&你只需要将上面代码中的 Indexes 去掉,就可以禁止Apache 显示该目录结构。用户就不会看到该目录下的文件和子目录列表了。Indexes 的作用就是当该目录下没有 index.html 等文件时,就显示目录结构。现改为如下:&Directory &var/www/html&&Options FollowSymLinksAllowOverride NoneOrder allow,denyAllow from all&/Directory&另外也可以在 Indexes 前加一个减号 “-”,同样可以禁止Apache显示目录结构。在Indexes前加 “+” 代表允许目录浏览;加 “-” 代表禁止目录浏览。修改如下:&Directory &var/www/html&&Options -Indexes FollowSymLinksAllowOverride NoneOrder allow,denyAllow from all&/Directory&
最新教程周点击榜
微信扫一扫扫描二维码: 已优化适合手机访问
&&★ 相关文章

我要回帖

更多关于 apache列出目录 的文章

 

随机推荐