CentOS 7.4 で確認しました。
phpMyAdmin のインストール
sudo yum install phpmyadmin -y
アクセス制限は
/etc/httpd/conf.d/phpMyAdmin.conf
で行ないます。
インストール直後は、localhost だけがアクセス可能です。
確認
curl http://localhost/phpMyAdmin/
ある特定の アドレスを許可したい時、
例えば 153.203.107.102 を許可する例
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip 153.203.107.102
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 153.203.107.102
Allow from ::1
</IfModule>
</Directory>
総てのIPからのアクセスを許可する例
<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
Require all granted
</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
Allow from All
</IfModule>
</Directory>
DHCP で IP アドレスが変動する場合の設定
153.203.. からのアクセスを許可する例
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip 153.203.
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 153.203.
Allow from ::1
</IfModule>
</Directory>