无法在我的EC2 LAMP实例

时间:2016-08-25 09:41:23

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

几天前我能够在我的EC2上成功登录我的phpMyAdmin,但现在它给了我一个403禁止的错误。 我看过this帖子和this帖子,他们基本上建议允许所有IP访问。我做了他们的建议,但对我来说并不适用。

我认为出了什么问题,而且我可能不对,但过去几天我做了以下事情,他们可能会产生影响: - 我下载了一个新的访问密钥 - 我删除了一个与正在运行的实例无关的弹性IP - 我删除了一个NAT网关。

目前,我的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
Alias /phpMyAdmin /usr/share/phpMyAdmin

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

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

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

我将其更改为上面提到的两个帖子,然后重新启动了apache和mysql但没有发生任何事情。它仍然显示403.请在此提供一些指导。

1 个答案:

答案 0 :(得分:0)

根据我的理解,它与您的Ec2实例附带的安全组配置相关。检查phpMyAdmin端口是否为您的IP打开。