0

My /etc/httpd/conf.d/phpMyadmin.conf has the following configurations

# 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>

When I access at my page EC2 instance as http://xx.xx.xx.xxx/phpmyadmin, I have You don't have permission to access /phpmyadmin on this server. error. I made sure this ip address xx.xx.xx.xxx is my EC2's Elastic IP address. phpMyadmin.conf has correct xx.xx.xx.xxx to allow. I tried to follow the similar links of this, this and this. But still have the error. What could be wrong with my error? My EC2 instance has AWS linux OS installed.

Thanks

Community
  • 1
  • 1
batuman
  • 7,066
  • 26
  • 107
  • 229

2 Answers2

0

As per my understanding this configuration is related to PhpMyadmin. In order to load this configuration into Apache Web Server, Make sure Apache is loading all the configuration files from conf.d by looking into httpd.conf if you are using apache [Not Apache2] and apache2.conf [for Apache2].

Inside /etc/apache2/apache2.conf, you will find the following line, which includes those files:

# Include generic snippets of statements
Include conf.d/

[Refference]

You might have checked it still, it is one of the solution.

Community
  • 1
  • 1
Vardhman Patil
  • 517
  • 6
  • 22
0

I have same error. Follow this link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html to do all owner and group changes. Did all as you did above, but it's getting that error. Finally after restarting httpd, I become able to connect.