title: EC2 AWS - You don't have permission to access /phpmyadmin on this server
body: <p>I am new to Amazon Web Services. I have followed all the steps to launch <code>EC2</code> and <code>RDS</code> instances. Have installed all the required packages also like <code>phpmyadmin</code>, <code>mysql</code> etc. Now am getting bellow error when trying <code>http://my_ip/phpmyadmin</code></p>
  
  <blockquote>
    <p>Forbidden</p>
    
    <p>You don't have permission to access /phpmyadmin on this server.</p>
  </blockquote>
  
  <p>For the solution I have searched a lot and got some solution that I have to change <code>127.0.0.1</code> to <code>my ip address which I got after creating EC2 instance</code> in <code>/etc/httpd/conf.d/phpMyAdmin.conf</code>. So when I try to edit this file it says <code>perrmission denied</code>. I have used below commands to give permission to <code>ec2-user</code></p>
  
  <pre><code>[ec2-user ~]$ sudo groupadd www
  
  [ec2-user ~]$ sudo usermod -a -G www ec2-user
  
  [ec2-user ~]$ sudo chown -R root:www /var/www
  
  [ec2-user ~]$ sudo chmod 2775 /var/www
  
  [ec2-user ~]$ find /var/www -type d -exec sudo chmod 2775 {} \;
  
  [ec2-user ~]$ find /var/www -type f -exec sudo chmod 0664 {} \;
  </code></pre>
  
  <p>And it was working perfectly till the yestarday but I can't understand that suddenly what happened to it. Can anyone please help me? </p>
  
  <pre><code># 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
  
  &lt;Directory /usr/share/phpMyAdmin/&gt;
     AddDefaultCharset UTF-8
  
     &lt;IfModule mod_authz_core.c&gt;
       # Apache 2.4
       &lt;RequireAny&gt;
         Require ip my_ip
         Require ip ::1
       &lt;/RequireAny&gt;
     &lt;/IfModule&gt;
     &lt;IfModule !mod_authz_core.c&gt;
       # Apache 2.2
       Order Deny,Allow
       Deny from All
       Allow from my_ip
       Allow from ::1
     &lt;/IfModule&gt;
  &lt;/Directory&gt;
  
  &lt;Directory /usr/share/phpMyAdmin/setup/&gt;
     &lt;IfModule mod_authz_core.c&gt;
       # Apache 2.4
       &lt;RequireAny&gt;
         Require ip my_ip
         Require ip ::1
       &lt;/RequireAny&gt;
     &lt;/IfModule&gt;
     &lt;IfModule !mod_authz_core.c&gt;
       # Apache 2.2
       Order Deny,Allow
       Deny from All
       Allow from my_ip
       Allow from ::1
     &lt;/IfModule&gt;
  &lt;/Directory&gt;
  
  # These directories do not require access over HTTP - taken from the original
  # phpMyAdmin upstream tarball
  #
  &lt;Directory /usr/share/phpMyAdmin/libraries/&gt;
      Order Deny,Allow
      Deny from All
      Allow from None
  &lt;/Directory&gt;
  
  &lt;Directory /usr/share/phpMyAdmin/setup/lib/&gt;
      Order Deny,Allow
      Deny from All
      Allow from None
  &lt;/Directory&gt;
  
  &lt;Directory /usr/share/phpMyAdmin/setup/frames/&gt;
      Order Deny,Allow
      Deny from All
      Allow from None
  &lt;/Directory&gt;
  
  # This configuration prevents mod_security at phpMyAdmin directories from
  # filtering SQL etc.  This may break your mod_security implementation.
  #
  #&lt;IfModule mod_security.c&gt;
  #    &lt;Directory /usr/share/phpMyAdmin/&gt;
  #        SecRuleInheritance Off
  #    &lt;/Directory&gt;
  #&lt;/IfModule&gt;
  </code></pre>