403在AWS EC2实例上禁止访问phpmyadmin

问题描述 投票:0回答:2

我的/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
Alias /phpmyadmin /usr/share/phpMyAdmin

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>

       Require ip xx.xx.xx.xxx
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow

    #Deny from All
     Allow from xx.xx.xx.xxx
     Allow from ::1
   </IfModule>
</Directory>

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

当我在我的页面EC2实例访问http://xx.xx.xx.xxx/phpmyadmin时,我有You don't have permission to access /phpmyadmin on this server.错误。我确定这个IP地址xx.xx.xx.xxx is my EC2's Elastic IP address。 phpMyadmin.conf有正确的xx.xx.xx.xxx允许。我试图遵循thisthisthis的类似链接。但仍然有错误。我的错误可能有什么问题?我的EC2实例安装了AWS linux OS。

谢谢

mysql amazon-web-services amazon-ec2 phpmyadmin http-status-code-403
2个回答
0
投票

据我了解,此配置与PhpMyadmin有关。为了将此配置加载到Apache Web Server,如果您使用的是apache [Not Apache2]和apache2.conf [for Apache2],请确保Apache通过查看conf.d来加载httpd.conf中的所有配置文件。

在/etc/apache2/apache2.conf中,您将找到以下行,其中包括这些文件:

# Include generic snippets of statements
Include conf.d/

[Refference]

您可能已经检查过它,这是解决方案之一。


0
投票

我有同样的错误。点击此链接https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html进行所有所有者和组的更改。就像你上面所做的一样,但它正在犯这个错误。最后重启httpd后,我才能连接。

© www.soinside.com 2019 - 2024. All rights reserved.