在 ec2 实例上访问 phpMyAdmin 时出现 403 错误

403 Error when accessing phpMyAdmin on an ec2 Instance

我想在 amazon's tutorial 之后使用 Amazon-Linux 在新的 EC2 实例上安装 LAMP 环境。然后我想要 phpMyAdmin,所以我使用 sudo yum --enablerepo=epel install phpmyadmin 安装它并在 www 目录 sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin.

中创建了一个 link

然后我更改了 /etc/httpd/conf.d/phpMyAdmin.conf 文件以允许访问。

当前文件:

# 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

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

 Order allow,deny
 Allow from all
</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>

但是当我尝试访问 /phpMyAdmin

时,我仍然遇到 403 错误

error_log:

[Thu Aug 27 13:45:47.702678 2015] [authz_core:error] [pid 25763] [client 37.49.61.176:59958] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/
[Thu Aug 27 13:45:48.699611 2015] [authz_core:error] [pid 25763] [client 37.49.61.176:59958] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/
[Thu Aug 27 13:49:22.181819 2015] [authz_core:error] [pid 25765] [client 37.49.61.176:60222] AH01630: client denied by server configuration: /usr/share/phpMyAdmin/

还有什么错误?

我删除后问题得到解决

Alias /phpMyAdmin /usr/share/phpMyAdmin

来自

/etc/httpd/conf.d/phpMyAdmin.conf

然后不要忘记使用以下命令重新启动

sudo service httpd restart

将以下代码复制到您的 /etc/httpd/conf.d/phpMyAdmin.conf

I found it here http://howsolve.com/i-always-get-a-403-error-with-phpmyadmin-ec2-aws/

    # 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

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

     Order allow,deny
     Allow from all
    </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>