无法从网络浏览器访问phpmyadmin

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法从网络浏览器访问phpmyadmin相关的知识,希望对你有一定的参考价值。

操作系统:CentOS Linux 7(酷睿)x86-64

我已经安装了phpmyadmin和httpd(apache-httpd-2.4.6-80.el7.centos.1.x86_64);

我从/etc/httpd/conf.d/phpMyAdmin.conf配置/编辑了phpmyadmin

重新启动Apache,我收到Forbidden错误您无权访问此服务器上的/ phpMyAdmin /。

我的conf文件,这里是42.108.56.117(我编辑过这个)是我自己的IP,4.4.4.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 42.108.56.117
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 42.108.56.117
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 42.108.56.117
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 42.108.56.117
     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>

我也试过从stackoverflow使用这个解决方案,但它没有用,任何人都得到了这个问题的答案?

取而代之:

<Directory /usr/share/phpMyAdmin/>
    <IfModule mod_authz_core.c>
        # Apache 2.4
        <RequireAny>
            Require ip 127.0.0.1
            Require ip ::1
        </RequireAny>
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order Deny,Allow
        Deny from All
        Allow from 127.0.0.1
        Allow from ::1
    </IfModule>
</Directory>

有了这个:(但它仍然没有奏效)

<Directory "/usr/share/phpMyAdmin/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Allow,Deny 
    Allow from all
</Directory>

还在寻找这个问题的答案....

答案

好的,我找到了答案,

我首先编辑了这个conf;

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

并重新启动apache并完成,它对我来说很好。

如果有人遇到过这个问题,请不要犹豫,在这里发表评论我一定会以任何可能的方式提供帮助。美好的一天!

以上是关于无法从网络浏览器访问phpmyadmin的主要内容,如果未能解决你的问题,请参考以下文章

无法从 Web 浏览器访问 phpmyadmin

我无法访问本地网络和 phpMyAdmin

无法连接到 MAMP 中的 phpmyadmin

无法访问 phpmyadmin(403 权限错误)

Phpmyadmin 可以从任何登录名和密码访问

从 xampp 访问 phpmyadmin 时访问被拒绝错误