为了账号安全,请及时绑定邮箱和手机立即绑定

错误消息“禁止您访问/在此服务器上没有权限”

错误消息“禁止您访问/在此服务器上没有权限”

跃然一笑 2019-06-19 15:16:49
错误消息“禁止您访问/在此服务器上没有权限”我自己配置了我的apache,并尝试加载phpMyAdmin在虚拟主机上,但我收到了:禁止您访问/访问此服务器我的httpd.conf# # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.2> for detailed information. # In particular, see  # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html> # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do.  They're here only as hints or reminders.  If you are unsure # consult the online docs. You have been warned.   # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path.  If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/foo.log" # with ServerRoot set to "C:/Program Files (x86)/Apache Software Foundation/Apache2.2" will be interpreted by the # server as "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/logs/foo.log". # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). # If a drive letter is omitted, the drive on which httpd.exe is located # will be used by default.  It is recommended that you always supply # an explicit drive letter in absolute paths to avoid confusion.和vhosts.conf:NameVirtualHost 127.0.0.1:80 <VirtualHost 127.0.0.1:80>     DocumentRoot i:/projects/webserver/__tools/phpmyadmin/     ServerName dbadmin.tools </VirtualHost>
查看完整描述

3 回答

?
大话西游666

TA贡献1817条经验 获得超14个赞

我知道这个问题已经解决了,但我碰巧自己解决了这个问题。

原因

禁止您没有访问/在此服务器上的权限

中的apache目录的默认配置。httpd.conf.

#
# 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          # the cause of permission denied
</Directory>

简单改变Deny from allAllow from all应该解决许可问题。

或者,更好的方法是在虚拟主机配置上指定单独的目录权限。

<VirtualHost *:80>
    ....

    # Set access permission
    <Directory "/path/to/docroot">
        Allow from all
    </Directory>

    ....
</VirtualHost>

截至Apache-2.4但是,访问控制是使用新模块完成的。mod_authz_host (从2.2升级到2.4)。因此,新的Require应该使用指令。

<VirtualHost *:80>
    ....

    # Set access permission
    <Directory "/path/to/docroot">
        Require all granted
    </Directory>

    ....
</VirtualHost>


查看完整回答
反对 回复 2019-06-19
  • 3 回答
  • 0 关注
  • 1618 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信