apache 允许浏览目录

<Directory /var/www/blog/userfiles/>
#开启目录列表索引模式
 Options Indexes
 Order allow,deny
 IndexOptions NameWidth=250 Charset=UTF-8 
 Allow from all
 </Directory>

参数"Options Indexes"表示启用目录浏览,"IndexOptions Charset=UTF-8"设置字符集,以消除中文乱码,NameWidth=250 :指定目录列表可以显示最长为125字节的文件/目录名。

Apache log:
后来在log中找到如下一行

Directory index forbidden by Options directive: /var/www/html/

google一下,采用了一个高人得建议,删除以下两个页面

rm -f /etc/httpd/conf.d/welcome.conf  ← 删除测试页

rm -f /var/www/error/noindex.html  ← 删除测试页

再次打开站点,又是报错“You don‘t have permission to access / on this server.”,关了iptables和selinux还是无果,于是动手重启apache,报错
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
唉,原来进程端口被占用
# ps -aux|grep httpd   //找到进程号
# kill -9  xx  //杀掉进程XX
# /usr/local/apache2/bin/apachectl -k start   //启动apache

启动成功,站点打开成功

apache 允许浏览目录,布布扣,bubuko.com

时间: 2024-08-19 05:31:19

apache 允许浏览目录的相关文章

Apache服务器程序目录结构和配置文件路径

本文主要讲述apache主要目录结构及主要配置文件 1.apache目录结构 [[email protected] apache]# tree -L 1.|-- bin       程序命令目录|-- build|-- cgi-bin|-- conf      配置文件目录|-- error|-- htdocs    编译安装时站点目录|-- icons|-- include|-- lib |-- logs       默认日志文件存放包括错误日志(error_log)和访问日志(access_

禁止apache显示目录索引 apache禁止列目录

禁止apache显示目录索引 apache禁止列目录 禁止Apache显示目录索引的常见的3种方法. 要实现禁止Apache显示目录索引,只需将Option中的Indexes去掉即可. 禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思. 下面说下禁止Apache显示目录索引的常见的3种方法.要实现禁止Apache显示目录索引,只需将 Option 中的 Indexes 去掉即可.1)修改目录配置:<Directory

禁止apache显示目录索引的常见方法(apache禁止列目录)

禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思.下面说下禁止禁止Apache显示目录索引的常见的3种方法. 要实现禁止Apache显示目录索引,只需将 Option 中的 Indexes 去掉即可. 1)修改目录配置: 只需要将上面代码中的 Indexes 去掉,就可以禁止 Apache 显示该目录结构.用户就不会看到该目录下的文件和子目录列表了.Indexes 的作用就是当该目录下没有 index.html 文件

Apache 配置虚拟目录和虚拟主机

Apache配置虚拟目录 在httpd.conf文件中添加 大约在245行 # Create Virtual catalogue <IfModule dir_module> DirectoryIndex index.html index.htm index.php Alias /MyWeb "c:/MyWeb" // 在C盘的根目录下有一个Myweb文件夹,可以把这个文件夹看做虚拟目录 <Directory c:/MyWeb> Order allow,deny

MFC中浏览文件和浏览目录的实现[转]

1. 浏览文件 1 void CDlgCompare::OnBnClickedBtnSel() 2 { 3 // TODO: Add your control notification handler code here 4 UpdateData(TRUE); 5 CFileDialog fileDlg(TRUE); 6 fileDlg.m_ofn.lpstrTitle="文件打开对话框"; 7 fileDlg.m_ofn.lpstrFilter="All Files(*.*

CentOS Linux系统下更改Apache默认网站目录

引言:Apache默认的网站目录是在/var/www/html,我们现在要把网站目录更改到/home/wwwroot/web,操作如下 准备工作:创建目录:cd /homemkdir wwwrootcd wwwrootmkdir webtouch index.php 操作步骤:1.vi /etc/httpd/conf/httpd.conf找到 DocumentRoot "/var/www/html" 这一段 #apache的根目录把/var/www/html 这个目录改为/home/w

Apache的主要目录和配置文件详解

一.Apache 主要配置文件注释Apache的主配置文件:/etc/httpd/conf/httpd.conf默认站点主目录:/var/www/html/Apache服务器的配置信息全部存储在主配置文件/etc/httpd/conf/httpd.conf中,这个文件中的内容非常多,用wc命令统计一共有1009行,其中大部分是以#开头的注释行. ServerTokens OS在出现错误页的时候是否显示服务器操作系统的名称,ServerTokens Prod为不显示 ServerRoot "/et

apache 配置虚拟目录

1.apache 配置虚拟目录 找到 httpd.conf 在 <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow #Deny from all</Directory> 节点下输入Alias /bbb "c:/zzz/" 即可

apache限制某个目录禁止解析php、apache禁止指定user_agent、php相关配置

一:apache限制某个目录禁止解析php 某个目录下禁止解析 php,这个很有用,我们做网站安全的时候,这个用的很多,比如某些目录可以上传文件,为了避免上传的文件有×××,所以我们禁止这个目录下面的访问解析php. <Directory /data/www/data> php_admin_flag engine off <filesmatch "(.*)php"> Order deny,allow Deny from all </filesmatch&g