安装apache遇到You don’t have permission to access this resource. 原因与解决方法

Posted blind_mokey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装apache遇到You don’t have permission to access this resource. 原因与解决方法相关的知识,希望对你有一定的参考价值。

给公司配置php服务器,用apache进行操作,遇到如标题那个问题,无法进行远程HTTP请求,解决办法如下

apach/conf/httpd.conf文件修改如下:

<Directory />
    Options FollowSymLinks
    AllowOverride all
    Require local
</Directory>

修改为:

<Directory />
    Options FollowSymLinks
    AllowOverride none
    Require all granted
</Directory>

以及下方的

DocumentRoot "$INSTALL_DIR/www"
<Directory "$INSTALL_DIR/www/">
    Options FollowSymLinks
    AllowOverride all
    Require local
</Directory>

修改为:

DocumentRoot "$INSTALL_DIR/www"
<Directory "$INSTALL_DIR/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

此时还是不行,被干的稀碎,参考大佬原帖:https://bbs.csdn.net/topics/390904273?list=23494857

但是他可能没提醒用户httpd-vhosts.conf也要改,路径在apach/conf/extra/httpd-vhosts.conf里面

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "$INSTALL_DIR/www"
  <Directory "$INSTALL_DIR/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride all
    Require local
  </Directory>
</VirtualHost>

修改为:

# Virtual Hosts
#
<VirtualHost *:80>
  #ServerName localhost
  ServerAlias localhost
  DocumentRoot "$INSTALL_DIR/www"
  <Directory "$INSTALL_DIR/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride None
    Require all granted
  </Directory>
</VirtualHost>
然后重启apache,成功。

希望文章对你有帮助

以上是关于安装apache遇到You don’t have permission to access this resource. 原因与解决方法的主要内容,如果未能解决你的问题,请参考以下文章

redhat centos apache 403 错误 Forbidden You don't have permission to access / on this server(示例代码

apache2.4 You don‘t have permission to access / on

安装phpstudy 测试出现403错误 Forbidden You don't have permission to access / on this server. 跪求解

linux apache Forbidden You don't have permission to access / on this server.

403 Forbidden You don‘t have permission to access this resource. Apache Server at IP Port 80的解决方法

Apache(httpd) 报错You don't have permission to access /on this server.