apache 提示You don't have permission to access /test.php on this server.怎样解决
?
关键字: Apache?? 403? Forbidden
系统配置:
操作系统:Red Hat Linux 6.2
Web服务器:Apache 3.1.1+jakarta-tomcat 3.1.1
数据库服务器:oracle 8i
??? Apache服务器是目前应用最多的web服务器,据统计在世界上的服务器中有超过一半采用Apache服务器.关于它的好处,您可以自己到http://www.apache.org/上去看。
??? 今天我们的服务器出了一点儿问题:任何访问都会返回一个403的错误:
? Forbidden??
? You don't have permission to access? on this server。
? 不对呀,原来还好好的,在排除了目录的权限等的问题外,我几乎翻遍了系统的所有文件,尤其是/etc/httpd/conf下的所有配置文件,因为我已经将access.conf,srm.conf文件加入到httpd.conf文件中,同时在httpd.conf文件的最后加上了一句:
Include /etc/httpd/conf/tomcat.conf,以便将tomcat和apache连接起来。
在经过了一番思考之后,我认为问题肯定出在httpd.conf文件中,于是就又重新检查httpd.conf文件,终于让我发现了其中有这样一段:
<Files ~>
AllowOverride AuthConfig FileInfo Indexs Limit Options
Order allow ,deny
Deny from all-----------------注意:就是这儿!!--->把这行去掉或注释掉就行!!!
</Files>
心头一阵狂喜,哈哈,想起赵本山说的一句话“小样儿,脱了马甲我也认得你”,于是改成:
Allow from all,重新启动服务器,咦,还是不行?头开始大了,心想:今儿个我是载这儿了。又翻了n多遍httpd.conf文件几乎都要背下来了还找不到问题。也怪,突然就想起来了,www.apache.org不是有个问题数据库吗,几乎所有的问题都可以在上面找到答案,于是进入http://bugs.apache.org/,查找关键字forbidden,果然就让我查到了,原来是我们一位同事想做一个虚拟主机,用了linux的配置工具linuxconf,这个工具因为版本的问题,会导致httpd.conf文件的修改,其实我只要将上面的那一段去掉就可以万事大吉了。
最终总结经验:遇到事情首先要想到到软件所在的网站上找答案,免得浪费时间。
写此文的目的:以我为反面教材,遇到问题不要自己总是认为自己可以解决,而不到专业网站上请教。很多的网站已经有了非常完善的faq,基本上可以满足大家平时的需求,比如pb的要多到www.sybase.com上走走,java到http://developer.java.sun.com上转转,vc到坏孩子家溜溜。其实一些高手不是他们有多聪明,而是他们懂得如何从有用的地方找到自己想要的东西。
我也象他那样找到了希望,也没管用。后来我乐了,但后来我又乐不起来了。那着在我这里不行啊?谁能帮我?我找!我找!不行就自救。
===================================================
===================================================
解决Apache下403 Forbidden错误
正 文:
????今天在公司电脑上安装Apache,版本2.2.8,装完刚测试可以;配置了下php的php.in文件再次localhost打开发现错误:HTTP?错误?403?-?禁止访问,即403?Forbidden:You?don't?have?permission?to?access?/?on?this?server.权限又不够了?
?
????马上打开apache的配置文件httpd.conf,逐行检查。在大约快一半的地方有以下这段代码:
?
<Directory?/>????Options?FollowSymLinks
????AllowOverride?None
????Order?deny,allow
????Deny?from?all
</Directory>
?
????发现了吧。由于配置了php后,这里的“Deny?from?all”已经拒绝了一切连接。把该行改成“allow?from?all”,修改后的代码如下,问题解决。
?
<Directory?/>????Options?FollowSymLinks
????AllowOverride?None
????Order?deny,allow
????allow?from?all
</Directory>
?
????再次在浏览器里打开http://localhost,显示it?works!
?
????总结:如果你也发生了这样的403禁止访问,不妨注意下apache的httpd.conf配置文件里有“Deny?from?all”这行的代码处,看看是不是哪里被系统悄悄地修改了。
转载之(http://www.cnblogs.com/qiantuwuliang/archive/2009/06/27/1512251.html)
?
上面这样也行,但是也不是唯一的,改下面这地方也行
?
找到set DocumentRoot to这个位置
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/HK-PHP/HKBiz/public"> //这个位置一定要下面的地方一样
??? #
??? # Possible values for the Options directive are "None", "All",
??? # or any combination of:
??? #?? Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
??? #
??? # Note that "MultiViews" must be named *explicitly* --- "Options All"
??? # doesn't give it to you.
??? #
??? # The Options directive is both complicated and important.? Please see
??? # http://httpd.apache.org/docs/2.2/mod/core.html#options
??? # for more information.
??? #
??? Options Indexes FollowSymLinks
??? #
??? # AllowOverride controls what directives may be placed in .htaccess files.
??? # It can be "All", "None", or any combination of the keywords:
??? #?? Options FileInfo AuthConfig Limit
??? #
??? AllowOverride None
??? #
??? # Controls who can get stuff from this server.
??? #
??? Order allow,deny
??? Allow from all
</Directory>
?
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
?DocumentRoot "D:/HK-PHP/HKBiz/public"//和这儿一样