5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

phpmyadminにアクセスできなかったら

Posted at

環境:
CentOS7
Apatch2.4.7

phpmyadminインストールして、いざアクセスしたときに

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

とエラーが出たら、Apatchの設定を見直す。

# vi /etc/httpd/conf.d/phpMyAdmin.conf

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
       Require ip 192.168.xxx.  ←ここ追加。接続元のIPアドレス
     </RequireAny>
   </IfModule>

接続元IPは、CentOSサーバから見たIPじゃないとダメ。
yumでインストールした場合、CentOSサーバから見たIPは、/var/log/httpd/access.logやerror.logにが記載されてる。

その他の書き方は以下。

Require all granted
無条件でアクセス許可。

Require all denied
無条件にアクセス拒否。

Require env env-var [env-var] ...
指定された環境変数のいずれかが設定されている場合にのみ、アクセス許可。

Require method http-method [http-method] ...
指定されたHTTPメソッドに対してのみアクセス許可。

Require expr expression
expressionがtrueと評価された場合にアクセス許可。

Require user userid [userid] ...
指定されたユーザーのみアクセス許可。

Require group group-name [group-name] ...
指定されたグループのユーザーのみアクセス許可。

Require valid-user
すべての有効なユーザーにアクセス許可。

Require ip 10 172.20 192.168.2
指定されたIPアドレス範囲内のクライアントにアクセス許可。(今回はコレ)

■参照:Apatch
https://httpd.apache.org/docs/2.4/ja/mod/mod_authz_core.html#require

5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?