Ubuntu 11.10:phpMyAdminへのアクセスを制限する方法

端末より、以下のコマンドを実行します。




$ sudo nano /etc/phpmyadmin/apache.conf



エディタが開き、phpMyAdminの設定を変更できるようになります。



<Directory /usr/share/phpmyadmin>以下にアクセス制限の記述を追加します。



<変更前>

<Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php

    ・・・・





<変更後>(赤字部分が追記内容です。)


<Directory /usr/share/phpmyadmin>

    Options FollowSymLinks
    DirectoryIndex index.php


    Order Deny,Allow

    Deny from all             
    ↑指定外からのアクセスを、禁止します。

    Avllow from 127.0.0.1
    Allow from 192.168.1.0/24
    ↑アクセスを許可する場所を記述します。
    

    ・・・・


・上記の例では、localhostと「192.168.1.1~255」からのアクセス(LAN内)のみを許可しています。





apacheを再起動します。
端末より以下コマンドを実行します。




$ sudo apache2ctl restart 



これで不特定な外部からのphpMyAdminへのアクセスはできなくなります。




0 件のコメント:

コメントを投稿