测试时遇到将一本地目录设置为一apache的虚拟主机,在httpd-vhosts.conf文件中进行简单设置,然后在hosts文件中将访问地址指向本地,启动apache,进行访问,却出现了You don't have permission to access / on this server的提示,baidu了一下,原来是因为我的虚拟主机目录为非apache安装目录下的htdocs,所以违反了apache对默认对网站根访问权限。

apache的默认虚拟主机根目录地址为../Apache Software Foundation/Apache2.2/htdocs 目录下,需要对httpd.conf文件进行修改才能指向其他目录。

在httpd.conf文件下找到这段:

  1. <span style="font-size: x-small;">#
  2. # Each directory to which Apache has access can be configured with respect
  3. # to which services and features are allowed and/or disabled in that
  4. # directory (and its subdirectories).
  5. #
  6. # First, we configure the "default" to be a very restrictive set of
  7. # features.
  8. #
  9. <Directory />
  10. Options FollowSymLinks
  11. AllowOverride None
  12. Order deny,allow
  13. Deny from all
  14. </Directory></span>
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

将之修改为

  1. <span style="font-size: x-small;"># 允许指向外部的目录进行访问
  2. <Directory />
  3. Options Indexes FollowSymLinks
  4. AllowOverride None
  5. </Directory></span>
# 允许指向外部的目录进行访问
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory> <Directory /> 
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride None
</Directory>

然后重启apache,就ok了。

Apache提示You don't have permission to access / on this server问题解决的更多相关文章

  1. Apache提示You don't have permission to access / on this server 解决

    本文链接:https://blog.csdn.net/Niu_Eva/article/details/90741894 Apache提示You don’t have permission to acc ...

  2. 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.怎样解决 关键字: Apache   403  For ...

  3. Mac OS X中配置Apache后提示You don't have permission to access / on this server

    根据这篇博客http://www.cnblogs.com/snandy/archive/2012/11/13/2765381.html,在mac系统中,配置的apache,配置完成后,提示 You d ...

  4. 输入http://localhost/,apache出现You don't have permission to access/on this server.的提示,如何解决?

    本地搭建wamp,输入http://127.0.0.1访问正常,当输入http://localhost/,apache出现You don't have permission to access/on ...

  5. Apache 2.4.27 局域网访问提示 You don't have permission to access / on this server

    问题: 本机用localhost和ip都可以访问,局域网不可以访问,并且出现提示 You don't have permission to access / on this server. 解决: 如 ...

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

    今天在部署一个系统时,在apache中新开了一个VirtualHost,然后设置了DocumentRoot,等访问时却提示“You don’t have permission to access / ...

  7. phpstudy无法访问主页,提示You don't have permission to access / on this server解决办法

    1.输入localhost提示:You don't have permission to access / on this server. 新版phpStudy为了安全,取消Apache和nginx列 ...

  8. php多站点配置以及Forbidden You don't have permission to access / on this server问题解决

    php多站点配置以及Forbidden You don't have permission to access / on this server问题解决 一.总结 一句话总结:我的问题是php的版本问 ...

  9. apache出现You don't have permission to access / on this server. 提示

    今天在新的linux上跑原来的代码,使用的虚拟主机的模式进行操作.几个相关的网站放在一个文件里,想法是通过网站列出的目录进行相应的网站进行操作.一切设置完成后,在浏览器中运行出现在You don't ...

随机推荐

  1. [LeetCode] 3Sum 解题思路

    Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...

  2. hdoj 5137 How Many Maos Does the Guanxi Worth【最短路枚举+删边】

    How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/5 ...

  3. Android中实现控件圆角边框

    首先,在drawable文件夹下新建一个xml文件: <?xml version="1.0" encoding="utf-8"?> <shap ...

  4. servlet中避免405错误的产生

    父类Parent(相当于HttpServlet):service方法,用于处理任务分发,doGet.doPost方法用于报错  关注的是子类Son(servlet)     目的:杜绝错误的产生 方式 ...

  5. 验证码 jsp生成

    <%@ page contentType="image/jpeg" import="java.awt.*, java.awt.image.*,java.util.* ...

  6. Java或web中解决所有路径问题

    Java开发中使用的路径,分为两种:绝对路径和相对路径.归根结底,Java本质上只能使用绝对路径来寻找资源.所有的相对路径寻找资源的方法,都不过是一些便利方法.不过是API在底层帮助我们构建了绝对路径 ...

  7. 推荐一个很好的富文本web编辑器UEditor

    前天产品提了一个编辑器的bug,本人找是找到了问题的症结,就是不好改.框架是压缩兼混淆后的代码.查一下,好多年前的框架... 咨询了一个同事有关旧框架的事情,他也建议我升级编辑器并帮忙帮我找了UEdi ...

  8. 【转】Android Studio 的小小配置

    这篇博文的内容列表: 1.编辑器的字体设置 2.预览XML布局 3.导入项目  4.显示行号  5.新建Java类和Component的子类 额~~程序猿一般话都不多,嘿嘿,那咱就直接图文吧~ ^_^ ...

  9. System.currentTimeMillis();

    1.  意义: currentTimeMillis()返回以毫秒为单位的当前时间,返回的是当前时间与协调世界时 1970 年 1 月 1 日午夜之间的时间差(以毫秒为单位測量).注意,当返回值的时间单 ...

  10. [Javascript + rxjs] Introducing the Observable

    In this lesson we will get introduced to the Observable type. An Observable is a collection that arr ...