OpenPNE3をlighttpd上で動かしてみる

をととひの夜に upsilo.net の HTTP サーバを Apache から lighttpd に置き換へる作業をしてました。別にあれが気になってた訳ぢゃないんですが、まあ気分転換みたいなものです。

今回使ふディストリビューションはいつもの Debian GNU/Linux ではなく Ubuntu (oneiric) です。なぜなら upsilo.net のサーバは Ubuntu だからです。

1. PHP5 をインストールする

なるべく aptitude 使ひますよ。

sudo aptitude install php5-cgi php5-cli php5-gd php5-sqlite php-apc

2. OpenPNE3 をダウンロード・設定する

まあこの辺は適当にさくっと。数十回ほどインストール作業すれば慣れます。

cd /usr/local/share/
git clone git://github.com/openpne/OpenPNE3.git openpne3
cd openpne3
cp config/ProjectConfiguration.class.php{.sample,}
cp config/OpenPNE.yml{.sample,}

3. プラグインとか入れまくる

git とかよく知らない人はこの手順ではなく他のブログ記事見ながら ./symfony openpne:install を使った方がいいです。

cd /usr/local/share/openpne3/plugins
git clone git://github.com/ebihara/opAuthMailAddressPlugin.git
git clone git://github.com/balibali/opDiaryPlugin.git
git clone git://github.com/tejimaya/opCommunityTopicPlugin.git
git clone git://github.com/tejimaya/opAshiatoPlugin.git
git clone git://github.com/martini2002jp/opMessagePlugin.git
git clone git://github.com/openpne-ospt/opAlbumPlugin.git
git clone git://github.com/nothan/opRankingPlugin.git
git clone git://github.com/ShinichiU/opCalendarPlugin.git
git clone git://github.com/kawahara/opPointPlugin.git
cd ../
./symfony openpne:permission
./symfony plugin:publish-asset

4. データベースの設定をする

MySQL めんどい。SQLite 知らない人はこの手順ではなく(以下略

cd /usr/local/share/openpne3/
mkdir /var/local/dbfiles
cat > config/databases.yml <<EOF
all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn: 'sqlite:/var/local/dbfiles/openpne3.sqlite'
      username: ~
      password: ~
      encoding: utf8
      profiler: false
EOF
./symfony doctrine:build --all --and-load
chgrp -R www-data /var/local/dbfiles
chmod -R g+w /var/local/dbfiles

5. lighttpd のインストール・設定をする

設定に url.rewrite-if-not-file が必要なので lighttpd のバージョンは 1.4.24 以上が必須。

sudo aptitude install lighttpd
ln -s /usr/local/share/openpne3/web /var/www/openpne3
sudo tee /etc/lighttpd/conf-available/90-openpne3.conf <<EOF
server.modules += ("mod_rewrite")

url.rewrite-if-not-file += (
  "^/openpne3/[^/]+\.php/.*$" => "$0",
  "^/openpne3/(.+)$" => "/openpne3/index.php/$1"
)
EOF
sudo lighttpd-enable-mod fastcgi fastcgi-php openpne3
sudo /etc/init.d/lighttpd force-reload

6. ブラウザで見てみる

どうかなどうかな。

http://localhost/openpne3/