Ubuntu 16.04 LTSでのadminer導入メモ


導入

$ sudo apt install adminer

localhostからしかアクセスできないように設定

/etc/adminer/apache.conf を以下のような感じに編集

diff --git a/adminer/apache.conf b/adminer/apache.conf
index 9e56fe3..88ab7e4 100644
--- a/adminer/apache.conf
+++ b/adminer/apache.conf
@@ -5,6 +5,9 @@ Alias /adminer /usr/share/adminer/adminer
 <Directory /usr/share/adminer/adminer>
        Options FollowSymLinks
        DirectoryIndex index.php
+       Order Deny,Allow
+       Deny from all
+       Allow from 127.0.0.1

        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php

apacheを再起動して設定反映

$ sudo service apache2 reload

動作確認

localhostではアクセスできて,

$ w3m -dump localhost/adminer
ログイン

データベース種類 [MySQL     ]
     サーバ      [                    ]
    ユーザ名     [                    ]
   パスワード    [                    ]

[ログイン] [ ]永続的にログイン
言語: [日本語      ] [使用]
Adminer 3.3.3  

remoteからはアクセスできる

$ ssh remote w3m -dump 192.168.1.102/adminer
Forbidden

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

利用時はssh user@sqlserver -L 8080:localhost:80とかする想定

remote$ ssh user@sqlserver -L 8080:localhost:80
remote$ w3m -dump http://localhost:8080/adminer
ログイン

データベース種類 [MySQL     ]
     サーバ      [                    ]
    ユーザ名     [                    ]
   パスワード    [                    ]

[ログイン] [ ]永続的にログイン
言語: [日本語      ] [使用]
Adminer 3.3.3