局域网内配置Discuz,web端访问server端,出现以下反馈:


Forbidden

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


网上的各种方法,主要集中于把

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
改成
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all
Allow from all #允许所有访问
Satisfy all
</Directory> 以及把
<Directory "D:/Wamp5/www">

    #
# 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 all #
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 </Directory>
改成
<Directory "D:/Wamp5/www">

    #
# 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 all #
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
# Deny from all # Allow from 127.0.0.1
Allow from all </Directory>

都没有效果。

从一位台湾省兄弟的博客(https://blog.longwin.com.tw/2014/03/apache-22-24-upgrade-conf-2014/)中看到,Apache2.2和2.4的设置方式是不一样的,总结如下:

    1. Deny All

      • 2.2 configuration:

        • Order deny,allow
        • Deny from all
      • 2.4 configuration:
        • Require all denied
    2. Allow All
      • 2.2 configuration:

        • Order allow,deny
        • Allow from all
      • 2.4 configuration:
        • Require all granted
    3. Allow HostDirectory 用 Require all granted
      • 2.2 configuration:

        • Order Deny,Allow
        • Deny from all
        • Allow from example.org
      • 2.4 configuration:
        • Require host example.org
    4. <Directory /var/>
      Options FollowSymLinks
      AllowOverride None
      Require all granted
      </Directory>

    5. FilesMatch 維持用 Order

      <FilesMatch ".+\.phps$">
      SetHandler application/x-httpd-php-source
      Order Deny,Allow
      Allow from all
      </FilesMatch>

也就是说,如果你用的是apache2.4,那么网上的那些方法基本上是没用的,得用新的设置方法。

然而,这些仍然没有解决我的问题。

走投无路的时候,翻到了conf/extra目录下的httpd-vhosts.conf,打开一看,内容如下:

<VirtualHost *:80>
ServerName localhost
DocumentRoot d:/wamp64/www
<Directory "d:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

很可疑,改一下试试,改成:

<VirtualHost *:80>
ServerName localhost
DocumentRoot d:/wamp64/www
<Directory "d:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

重启apache,成功!

现得知,httpd.conf中有一个选项,

#Virtual hosts

#Include conf/extra/httpd-vhosts.conf

用来指明是否使用额外的文件设置虚拟主机,这个选项在我这里默认是打开的:

#Virtual hosts

Include conf/extra/httpd-vhosts.conf

所以,apache使用的是conf/extra/httpd-vhosts.conf 这个文件里的设置。

所以,无论怎样设置httpd.conf,都是无效的。

You don't have permission to access的更多相关文章

  1. Forbidden You don't have permission to access / on this server PHP

    在新安装的谷歌游览器里,打不了PHP网站了,错误显示: Forbidden You don't have permission to access / on this server. 原因还是配置权限 ...

  2. wamp出现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 ...

  3. yii安装 /You don't have permission to access on this server

    在安装yii的时候 ,当打开了init.bat进行配置的时候小黑本弹出了个小黑框立刻就关闭了,  进入cmd模式再打开init.bat就出现了"You don't have permissi ...

  4. CentOS出错You don't have permission to access on this server

    之前配置phpmyadmin的时候,在浏览器上输入http://192.168.8.250/phpmyadmin/ 也遇到了You don't have permission to access on ...

  5. wampserver You don't have permission to access / on this server. 解决 方法(转,正好碰到这样的事情了就转下来)

    最近在安装最近版wampserver 2.2 d时发现安装好后启动服务器,访问localhost显示You don't have permission to access / on this serv ...

  6. WampServer phpadmin apache You don't have permission to access

    1.Forbidden You don't have permission to access / on this server. 后来咨询了一下朋友(php高手),说修改一下php的配置文件http ...

  7. Forbidden You don't have permission to access / on this server. You don't have permission to access /phpmyadmin/ on this server. 解决办法

    Forbidden  You don't have permission to access / on this server.   解决办法 打开 httpd.conf 文件, 将 #   onli ...

  8. 解决问题 “You don't have permission to access /index.html on this server.”

    前几天装一个linux 企业版5.0安装了apache,打开测试页面的时候出现如下错误: Forbidden You don't have permission to access /index.ht ...

  9. WAMP error: Forbidden You don't have permission to access /{you_app_name} on this server

    Forbidden You don't have permission to access /{you_app_name}on this server. 需要修改两处: wamp\bin\apache ...

  10. PHP错误:Forbidden You don't have permission to access / on this server.

    今天在测试一个php程序的时候,发现这个问题: Forbidden You don't have permission to access / on this server. 开始的时候我是用http ...

随机推荐

  1. C++ 程序可以定义为对象的集合

    C++ 基本语法C++ 程序可以定义为对象的集合,这些对象通过调用彼此的方法进行交互.现在让我们简要地看一下什么是类.对象,方法.即时变量. 对象 - 对象具有状态和行为.例如:一只狗的状态 - 颜色 ...

  2. 格局中@null的代码实现方式

    布局中通常会用到@null.如RadioButton常用的技巧通过RadioGroup实现Tab,需要设置android:button="@null".如果要在代码中动态创建控件, ...

  3. CentOS命令top下你不一定懂的cpu显示信息

    在使用top命令的时候会看到这么一行: 里面的各个值分别是什么意思呢? 今天被问到这个问题,发现答的不是很清楚.果然啊,天天用最多的top命令都还没摸透...惭愧...于是就查了些资料: 官方解释 C ...

  4. iOS 使用AFNetworking 设置cookie

    本问题是由于多账号访问统一服务器时, 由于服务器那边接收到sessionid一样, 故无法区分账号信息. 所以需要在移动端请求的时候重新设置cookie, 步骤如下: 1. 在登录的时候, 先将 re ...

  5. 阿里云ACE下的PHP开发环境搭建

    阿里云ACE下的PHP开发环境搭建 本系列文章由ex_net(张建波)编写.转载请注明出处. http://blog.csdn.net/ex_net/article/details/23999053 ...

  6. ASP.NET中相对路径的使用总结

    如果有一个网站上的图片的路径是这样的: http://localhost:2008/websit1/images/1.jpg websit1表示的是虚拟路径或者是站点 在asp.net中,如果我们在. ...

  7. WPF 在事件中绑定命令

    导航:MVVMLight系列文章目录:<关于 MVVMLight 设计模式系列> 其实这也不属于MVVMLight系列中的东东了,没兴趣的朋友可以跳过这篇文章,本文主要介绍如何在WPF中实 ...

  8. SSHLibrary库关键字汇总

    红色框的部分是设置系统用户标识符(不可缺少):$表示非超级用户  #表示超级用户

  9. js 判断数据类型的几种方法

    判断js中的数据类型有一下几种方法:typeof.instanceof. constructor. prototype. $.type()/jquery.type(),接下来主要比较一下这几种方法的异 ...

  10. ajax的历史

    ajax (AJAX开发) 编辑 AJAX即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术. AJAX ...