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]

你可能還檢查了它,它的一個解。