0

我/etc/httpd/conf.d/phpMyadmin.conf的phpMyAdmin禁止访问具有以下配置403在AWS EC2实例

# 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。 我试图按照类似链接this,thisthis。 但仍然有错误。我的错误可能有什么问题? 我的EC2实例安装了AWS Linux操作系统。

感谢

回答

0

按我的理解,这个配置与phpMyAdmin的。为了将此配置加载到Apache Web服务器,请确保Apache正在加载conf.d的所有配置文件,如果您使用的是Apache [Not Apache2]和apache2.conf [for Apache2],请查看httpd.conf

里面/etc/apache2/apache2.conf中,你会发现下面的线,其中包括这些文件:

# Include generic snippets of statements 
Include conf.d/ 

[Refference]

你可能还检查了它,它的一个解。