LoginSignup
3
3

More than 5 years have passed since last update.

virtualbox(centos)にphpmyadmin+nginxでインストールする方法メモ

Last updated at Posted at 2013-02-28

nginxでphpmyadminを設定する方法のメモ

環境

  • centos6.3(ゲストOS)
  • macosx10.8(ホストOS)

事前準備に必要なもの

参考にしたサイト

nginxの設定を追加する

ソースからコンパイルしている場合は/usr/local/nginx/conf/nginx.confとか
yumでインストールしている場合は
/etc/nginx/conf/conf.d/default.confとかにあります。
httpディレクティブの項目に追加するだけです。

/usr/local/nginx/conf/nginx.conf
http {
#下記の項目を追加
    server {
        listen       80;
        server_name  lo.pma.org;
        root   /home/web/lo.pma.org/www; #ドキュメントルートは適時変更してください
        index  index.php index.html index.htm;
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/web/lo.pma.org/www$fastcgi_script_name; #ドキュメントルートは適時変更してください
            include        fastcgi_params;
        }
    }
}

phpMyAdminのインストール

svnから一発で

#ココらへんの設定は各自で
cd /home/web/lo.pma.org/www
svn checkout https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/tags/STABLE/phpMyAdmin ./

configファイルの編集

デフォルトファイルは残しておきましょうね

/home/web/lo.pma.org/www/
cp /home/web/lo.pma.org/www/config.sample.inc.php /home/web/lo.pma.org/www/config.inc.php

編集

/home/web/lo.pma.org/www/config.inc.php
#修正前
$cfg['blowfish_secret'] = '';
#修正後
$cfg['blowfish_secret'] = 'ojwelolk6gmsswpgqosameeBmtxswelzamM4wdfcfolbz>'; #適当な42文字
#修正前
$cfg['Servers'][$i]['host'] = 'localhost';
#修正後
$cfg['Servers'][$i]['host'] = '127.0.0.1';

#追加
$cfg['Server'][$i]['port'] = '3306';

上記の設定の追加はmysqld_multiで複数ポートで運用している場合です。そうではない場合はblowfish_secretだけでOKです

nginxの再起動

動いていなければstartだけOKです。ちなみにrestartだと動かなかったです。

/etc/init.d/nginx stop
nginx を停止中:                                            [  OK  ]


/etc/init.d/nginx start
nginx を起動中:                                            [  OK  ]

hostOS側のhostsを追加

ローカル環境だと思うので

ifconfigで自分のipを調べる

ifconfig

#下記の項目(inet)がどこかにあるのでメモしておく(デフォルトだと192.168.xx.xxx)なはず
inet addr:192.168.56.101

hostsファイルの編集

※windowsの場合は「windows host」とかでググってください。
今回はmacの場合で説明します

/etc/hosts
sudo vim /etc/hosts

192.168.56.101  lo.jenkins.org #ifconfigで調べたipとホストOSから見る場合のvirtualhostを指定する

動作確認

hostsで書いたアドレスにアクセス
今回はhttp://lo.pma.orgにアクセスしてphpmyadminのログイン画面が見えればOK!!

大体10分くらいでできました。

3
3
2

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