欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.

程序员文章站 2022-06-22 19:54:58
...

转载地址:http://blog.****.net/u011017575/article/details/51754605


今天装了Apache2.4.20版本的,安装完成之后,我以后会和以前一样直接就能访问默认文件htdocs文件夹下的index.html文件,然而并没有。浏览器访问报的一直是403 Forbidden,网上找了一遍都说是,把

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

改成

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

就OK了,NO并不是,上面的那个是Apache2.2+里面的配置。 
我的httpd.conf里面的是这样的:

<Directory />
    AllowOverride none
    Require all denied
</Directory>
  • 1
  • 2
  • 3
  • 4

对没错就是这样的,php2.4+中是把Order deny,allow Deny from all两项合并为Require all denied的。好那么现在我将Require all denied改为允许状态Require all granted。然后重启Apache,还是没有用,这是为什么呢? 
真是气死宝宝了,经过一番折腾之后我才整明白了,记住一定记住:

#<Directory />
   # AllowOverride none
   # Require all denied
#</Directory>
  • 1
  • 2
  • 3
  • 4

一定是要注释的。 
注释之后,再修改下面的路径为自己要访问的目录下,就OK了。

DocumentRoot "/data/server/apache/htdocs/"
<Directory "/data/server/apache/htdocs/">
    Options Indexes FollowSymLinks
    AllowOverride none
    Require all granted
</Directory>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

还有就是不知道有没有人想我一样白痴,装好Apache之后,使用service httpd restart发现重启不了。 
那是因为没有将Apache的运行程序添加到系统服务中去,执行: 
cp /data/server/apache/bin/apachectl(自己安装的Apache的目录) /etc/init.d/apached 
就可以了。

CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
 
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
  • u013144287

    2017-11-01 17:133楼
  • 请问一下你现在的访问路径是什么呢?可以贴过访问的ip加路径吗?我就访问localhost:port或者加上localhost:port/data/server/apache/htdocs/都是被禁止的
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
  • lijunwyf

    2017-02-09 20:172楼
  • 引用“lijunwyf”的评论:&lt;Directory /&gt;被注释的话,会报这个错:

    Forbidden

    You do...

    多了一个错: Server unable to read htaccess file, denying access to be safe
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
  • lijunwyf

    2017-02-09 20:171楼
  • <Directory />被注释的话,会报这个错:

    Forbidden

    You don't have permission to access / on this server.
    Server unable to read htaccess file, denying access to be safe

lua学习系列一之配置环境与IDE

之所以想要学习lua是因为cocos官方出了一个基于eclipse的IDE,电脑装VS2012一直装不上去,苦于程序太多于是没有重装系统,最近才发现出现了这个IDE,心中的游戏梦想还是让我决定学起了l...

05-部署Discuz项目到Apache并运行

①将Discuz解压到htdocs文件夹下面 ②将upload目录中的文件剪切到Discuz目录中,然后将upload文件夹删除。 ③修改config.inc.php    数据库用户名,密码    ...
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.

就刚刚,Python圈发生一件大事!

都说人生苦短,要学Python!但刚刚Python圈发生的这件事,你们怎么看?真相在这里...

apache You don't have permission to access /test.php on this server解决方法

这篇文章主要介绍了apache You don't have permission to access /test.php on this server解决方法,需要的朋友可以参考下 键字: Apa...

apache 启动后访问网页提示You don't have permission to access / on this server.

记录我配置apache+php时遇到的一些常见问题。 1.使用httpd-2.4.27-x86-vc14+php-5.6.31-Win32-VC11-x86 搭建环境,安装完apache 启动后访问网...