※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアAMD Opteron 1352) です。
phpPgAdmin 専用にバーチャルホストを設定し、ブラウザで操作するように設定します。
sudo apt-get install phppgadmin
でインストールできます。
sudo mkdir -p /var/vhosts/postgre.weeeblog.net/htdocs
sudo chown -R www-data:www-data /var/vhosts/postgre.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/postgre.weeeblog.net
公開用ディレクトリを作成し、権限設定ののち、apache のバーチャルホスト設定ファイルを作成します。
<virtualHost *>
ServerName postgre.weeeblog.net
DocumentRoot /var/vhosts/postgre.weeeblog.net/htdocs
ErrorLog /var/vhosts/postgre.weeeblog.net/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
CustomLog /var/vhosts/postgre.weeeblog.net/access.log combined
ServerSignature On
# phpMyAdmin default Apache configuration
Alias / /usr/share/phppgadmin/
<DirectoryMatch /usr/share/phppgadmin/>
DirectoryIndex index.php
Options +FollowSymLinks
AllowOverride None
# order deny,allow
# deny from all
# allow from 127.0.0.0/255.0.0.0
# allow from all
<IfModule mod_php4.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals On
php_value include_path .
</IfModule>
<IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals On
php_value include_path .
</IfModule>
</DirectoryMatch>
</virtualHost>
Alias をつけといてやることで、ファイルをコピーしたりする手間が省けるので少し楽。また、ここでは必要ないのでコメントアウトしていますが、アクセス制限は適宜行ってください。
バーチャルホスト設定を書いたら、再起動して WEB アクセスしてみる。
sudo /etc/init.d/apache2 restart
WEB アクセスはできるものの、そのままではログインできないので、ログイン用のユーザを作成します。
sudo passwd postgres
su - postgres
で、ユーザ postgre にパスワードを設定し、ユーザ postgre になる。
createuser -P postgreuser
> Enter password for new role:
> Shall the new role be a superuser? (y/n) y
とし、ユーザ postgreuser を作成すれば、phpPgAdmin に postgreuser としてログインできるようになります。
ちなみに、パスワードを設定したユーザ postgres でログインしようとしても、「ログインが許可されませんでした。」と言われてログインできません。
Comments