apache出现You don’t have permission to access / on this server问题的解决

今天在部署一个系统时,在apache中新开了一个VirtualHost,然后设置了DocumentRoot,等访问时却提示“You don’t have permission to access / on this server”,以为是权限的问题,就将项目根目录改成777权限,结果还是不行,google一番,得到答案。

      修改httpd.conf文件,找到如下段:

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

      就是最后一行Deny from all引起的,改成Allow from all,然后重启apapche,问题解决。看这段上面的注释是:First, we configure the “default” to be a very restrictive set of features。看来默认是很严格的访问控制,也是基于安全的考虑。

      之所以在之前部署系统时没有遇到这个问题,是因为之前的系统都是基于java平台,在apache中直接将请求Proxy给了tomcat,所以就不存在apache中的目录访问权限设置了,这里mark下。

原文地址:https://www.cnblogs.com/xuan52rock/p/4514513.html