403访问ec2实例上的phpMyAdmin时出错

时间:2015-08-27 18:49:50

标签: mysql amazon-web-services amazon-ec2 phpmyadmin

我想在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的链接。

然后我修改了/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/

还有什么可能是错误?

2 个答案:

答案 0 :(得分:5)

我删除

后问题已解决
Alias /phpMyAdmin /usr/share/phpMyAdmin

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

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

sudo service httpd restart

答案 1 :(得分:2)

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

  

我在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>