网站制作学习网Linux→正文:apache 配置目录浏览
字体:

apache 配置目录浏览

Linux 2012/3/30 18:39:23  点击:不统计


apache设置目录浏览,配置目录浏览

首先找到apache的配置文件,我这边采用的是yum安装文件安装的。
默认的路径为 /etc/httpd/conf/httpd.conf

编辑一下,找到 Driectory ,默认的第一个是权限设置的
由原来的
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
更改为
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
然后找到了根目录的配置,更改为
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

重新启动apache,删除www/html下面的首页面,或者在下面配置里面去掉index等选项

重启后发现仍然被deny了 错误提示如下
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to

handle the request.

然后更改apache默认欢迎页面的守护进程配置文件,里面配置着404错误页面的相关配置。
进行编辑
vim /etc/httpd/conf.d/welcome.conf

<LocationMatch "^/+$">
    Options +Indexes#主要是这里一行,由原来的 - 改为+ 表示有权限读写 apache才能进行目录浏览,也可以删除了该配置文件
    ErrorDocument 403 /error/noindex.html
</LocationMatch>

重启apache 服务,查看网页,就可以看到apache目录浏览


·上一篇:php获取shell返回值 >>    ·下一篇:php apache 安全配置 >>
推荐文章
最新文章