CentOS phpmyadmin フォルダが禁止されています

CentOS phpmyadmin フォルダが禁止されています

php5、apache2、LAMP、PHPMyAdminをインストールしましたが、IPとPHPMyAdminを次のように入力するとhttp://__my_IP__/phpmyadminエラーが表示されています

禁止
このサーバーの /PHPMyAdmin/ にアクセスする権限がありません。

編集しましたphpmyadmin.conf は、このファイルは私のIPアドレスも追加し、私のIPアドレスを許可しましたが、それでも上記のエラーが表示されます。

私のphpmyadmin.confファイルは現在このようになっています

# 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 27.34.248.3
#Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow

データベースを簡単に管理できるように、PHPMyAdmin フォルダーにアクセスするにはどうすればよいでしょうか。私は Redhat Linux 7.3 を使用しており、すべてのパッケージが更新されています。

私を助けてください!

答え1

これは動作します。Centos 7。

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from All
   </IfModule>
</Directory>

答え2

次の構成を試してください:

  <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 ip 27.34.248.3
   </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 27.34.248.3
  </IfModule>
  </Directory>

Apache サービスを再起動します。

systemctl restart httpd

答え3

phpmyadminのApache設定ファイルを変更する必要があります

場所は /etc/httpd/conf.d/phpMyAdmin.conf です。

デフォルトの設定は次のとおりです:

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

次のように変更します:

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from All
   </IfModule>
</Directory>

コマンドを使用してApacheを再起動します

# service httpd restart

または

# systemctl restart  httpd.service

関連情報