403禁止访问phpMyAdmin,使用个人计算机IP进行正确配置

时间:2015-10-13 04:26:46

标签: phpmyadmin ip config

我正在尝试在我的VPS服务器上设置MySQL数据库和phpMyAdmin。 MySQL数据库启动很好,phpMyAdmin的网站部分也是如此。但是当我去(我的VPS ip here)/ phpmyadmin它说403 Forbidden Access - 你没有权限访问/ phpmyadmin /在这台服务器上。我的配置在所有4个空格中都有我的计算机IP。这是我的配置(我的实际替换为占位符供您查看):

# phpMyAdmin - Web based MySQL browser written in php
# 
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip (MY COMPUTER IP HERE)
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from (MY COMPUTER IP HERE)
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip (MY COMPUTER IP HERE)
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from (MY COMPUTER IP HERE)
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>

1 个答案:

答案 0 :(得分:0)

我在这里做了一些假设,但是您将别名/ phpmyadmin / usr / share / phpMyAdmin别名作为配置文件中的目录,但是当您创建“允许”语句时,您将允许访问/ usr它下面的/ share / phpMyAdmin / setup /目录。如果您尝试连接到/ phpMyAdmin,那么您的允许规则将不会覆盖父目录。您可能还想在.htaccess中查找会阻止连接的任何内容。