When I tried to access phpMyAdmin on a CentOS 7 system running Apache web server software, I saw the message below:
Forbidden
You don't have permission to access /phpmyadmin on this server.
I looked for phpmyadmin.conf
, but couldn't find it on the
system, but then realized that I needed to use an uppercase "M" and "A"
# locate phpmyadmin.conf # locate phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf
I thought I had allowed access from all internal systems on the same
LAN to phpMyAdmin on the
webserver by modifying phpMyAdmin.conf
to allow access from
the subnet on which the internal systems resided. I checked the configuration
file again and it appeared I had allowed access there.
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1 192.168.0
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 192.168.0
Allow from ::1
</IfModule>
</Directory>
Since the internal systems were on a 192.168.0.0/24 subnet, I had
added 192.168.0
previously to the Require IP
and Allow from
lines, so that access was allowed both from the
localhost address,
127.0.0.1, i.e., from the system itself, and from other systems on the LAN.
I knew I had done that quite some time ago and that the Apache webserver
had been restarted a number of times subsequent to that change.
I checked the IP address the server was seeing for the system from
which I had tried accessing it using
http://www.example.com/phpMyAdmin
and realized it was seeing
the external IP address of the firewall behind which the webserver resides,
because I had used the
fully
qualified domain name (FQDN) for the server, i.e., www.example.com, which
caused the connectivity from the internal system to the web server to go
out through the firewall and back in. When I used the internal IP address
for the webserver on which phpMyAdmin resided with
http://192.168.0.22/phpMyAdmin, I was able to access the phpMyAdmin interface
from an internal system on the LAN on which it resides.
References:
-
Installing phpMyAdmin on a CentOS System Running Apache
Date: August 8, 2010
MoonPoint Support