2

I have installed wordpress on a CentOS 6.6 server, everything works fine, WP, mysql etc but I cannot access the http://MY_IP/phpmyadmin page to import DB as I get:

You don't have permission to access /phpmyadmin on this server.

I checked the log in :

/var/log/httpd/error_log

And found :

[error] [client 192.168.2.12] client denied by server configuration: /usr/share/phpMyAdmin

The server IP is 192.168.2.101 and I tried to access from another machine with 192.168.2.12 IP. Tried to access from the server itself but doesnt work either.

Any idea how can I fix this ? Thanks!

CharlieRB
  • 22,566
  • 5
  • 56
  • 105
rf2632
  • 139
  • 1
  • 2
  • 9
  • 1
    https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-a-centos-6-4-vps - look for "Configure Apache Files"... you'll need to edit `/etc/httpd/conf.d/phpMyAdmin.conf` to allow your workstation IP, your entire subnet, or all connections to your Apache. – Kinnectus Jul 23 '15 at 11:39
  • 1
    P.s. :) Rather than put "Solved", if you "tick" your own answer this will accept the answer and the rest of the site will see that a solution has been accepted :) – Kinnectus Jul 23 '15 at 11:50

1 Answers1

1

I have found the solution:

I edited the file /etc/httpd/conf.d/phpMyAdmin.conf like the following :

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

 <IfModule mod_authz_core.c>
 # Apache 2.4
 <RequireAny>
   Require ip 127.0.0.1
   Require ip ::1
 </RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
#   Apache 2.2
    Order Deny,Allow
#     Deny from All
    Allow from 127.0.0.1
    Allow from ::1
</IfModule>
</Directory>

Basically I commented out : "Deny from All", httpd restarted and it works!

rf2632
  • 139
  • 1
  • 2
  • 9
  • 1
    Rather than comment out something that was put in by default (the safe options) you should really find out the "allow" rules... see the answer here and see if it helps... http://stackoverflow.com/questions/4400154/htaccess-deny-all-allow-only-one-ip – Kinnectus Jul 23 '15 at 11:49
  • Thanks! The intention of the WP site is just for internal use, nothing will go outside my lan so I am not bothering much for security and stuff. – rf2632 Jul 23 '15 at 12:06
  • If a system is Internet accessible, if you don't want to allow access from any IP address anywhere in the world just from other systems on a 192.168.2.0/24 subnet, you can [leave the `Deny from All` as is](http://support.moonpoint.com/blog/blosxom/2015/02/16#centos7), and have an `Allow from` address that keeps the [localhost](https://en.wikipedia.org/wiki/Localhost) address, 127.0.0.1, i.e., the system itself, but adds the 192.168.2 subnet with `Allow from 127.0.0.1 192.168.2` and a `Require ip 127.0.0.1 192.168.2` line in the RequireAny section – moonpoint Jul 23 '15 at 12:10