PrefShimaneCMSのインストール

島根県CMSをインストールするときに出会った諸問題を書き込む。

島根県CMS公式サイト
http://projects.netlab.jp/Pref......himaneCMS/

# tar zxvf pref-shimane-cms.1.0.1.tar.gz
# cd pref-shimane-cms.1.0.1
# cd doc
# more INSTALL

■■■必要なパッケージ
ruby irb ruby1.8-dev libpgsql-ruby1.8 libfcgi-ruby1.8 librmagick-ruby1.8 libopenssl-ruby1.8 rdoc zlib1g-dev lighttpd apache2 postgresql postfix
chasen chasen-dictutils libchasen-dev ipadic kakasi libkakasi-ruby1.8
zip unzip rsync libgd2-xpm libgd-ruby1.8 libxslt1-dev xsltproc gcc make

★サーバ日付が狂っている場合、date -s で強制設定する

# date -s ‘28 Feb 2008 15:40′

# yum install gcc
# yum install autoconf
# yum install automake
# yum install httpd
# yum install postfix
# yum install openssl-devel
# yum install ruby-devel

■必要なgemパッケージをインストール
——————————————————————————–
# gem install rake scrapi tidy –include-dependencies

■音声合成やルビ振りのページの作成のために、rubyからchasenを使用するためのライブラリが必要です。それらのパッケージをダウンロードしてインストールします。
——————————————————————————–

★ChaSen(およびその前提ソフトのDarts)と、ChaSenが使用する辞書(ipadic)のソースをインストール
http://chasen-legacy.sourceforge.jp/

★iconv または libiconv が必要
——————————————————————————–
# wget http://ftp.gnu.org/pub/gnu/lib.......10.tar.gz
# tar zxvf libiconv-1.10.tar.gz
# cd libiconv-1.10
# ./configure –prefix=/usr/local
# make
# make install

★ChaSenの前提ソフトのDartsをインストール
——————————————————————————–
gcc-c++がないとエラーになるので、先にインストールする
# yum install gcc-c++

# wget http://chasen.org/~taku/softwa......0.2.tar.gz
# tar zxvf darts-0.2.tar.gz
# cd darts-0.2
# ./configure
# make
# make check
# make install

■いよいよ、Chasenのインストール
——————————————————————————–
# wget http://chasen.aist-nara.ac.jp/......3.3.tar.gz
# tar zxvf chasen-2.3.3.tar.gz
# cd chasen-2.3.3
# ./configure –with-darts=/usr/local/include –with-libiconv=/usr/local/lib
# make

・・・中略・・・
dartsdic.cpp: In function ‘int da_build_dump(da_build_t*, char*, FILE*)’:
dartsdic.cpp:180: error: invalid lvalue in assignment
make[2]: *** [dartsdic.lo] Error 1
make[2]: Leaving directory `/usr/local/src/chasen-2.3.3/lib’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/chasen-2.3.3′
make: *** [all] Error 2

★上記エラーの解決方法
# cd lib
# vi dartsdic.cpp

180行目を次のように変更:
180,182c180
< /* (const char*)keys[size] = key.data();
< */
< keys[size] = (char*)key.data();

> (const char*)keys[size] = key.data();

# ./configure –prefix=/usr/local/chasen –with-darts=/usr/local/include –with-libiconv=/usr/local/lib
# make
# make install

★シンボリックリンクをはる
# ln -s /usr/local/chasen/bin/chasen /usr/bin/chasen

■ipadicのインストール
——————————————————————————–
# wget http://osdn.dl.sourceforge.jp/......7.0.tar.gz
# tar zxvf ipadic-2.7.0.tar.gz
# cd ipadic-2.7.0
# ./configure –with-chasen-config=/usr/local/chasen/bin/chasen-config
# make
# make check
# make install

・・・中略・・・
if test -f /usr/local/chasen/etc/chasenrc ; then \
echo “Please modify /usr/local/chasen/etc/chasenrc”; \
else \
cp chasenrc /usr/local/chasen/etc/chasenrc ;\
fi
cp: cannot create regular file `/usr/local/chasen/etc/chasenrc’: No such file or directory
make[2]: *** [install-data-local] Error 1
make[2]: Leaving directory `/usr/local/src/ipadic-2.7.0′
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/usr/local/src/ipadic-2.7.0′
make: *** [install-recursive] Error 1

★エラー対策
# cp chasenrc /usr/local/chasen/etc/

★やり直し
# make
# make install

■最後に ruby-chasen のインストール
——————————————————————————–
# wget http://raa.ruby-lang.org/cache......1.6.tar.gz
# cd chasen1.6
# ruby extconf.rb

Warning:extconf.rb:2: parsearg is deprecated after Ruby 1.8.1; use optparse instead

対策:
# ruby -rmkmf -e ‘dir_config(”chasen”,”/usr/local”); \
> have_library(”stdc++”); create_makefile(”chasen”) if have_library(”chasen”)’

# make
# make install
# /sbin/ldconfig -v

■音声合成プログラムであるlameをインストール
——————————————————————————–
# wget http://downloads.sourceforge.n.......97.tar.gz
# cd lame-3.97
# ./configure
# make
# make install

■本プログラムのインストール
——————————————————————————–
★staffというグループが sudo コマンドを利用できるように設定

# visudo

staff の行を追加してから保存する。

## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
%staff ALL=(ALL) ALL

# useradd www-data
# mkdir -p /var/share/cms
# chown -R www-data:www-data /var/share/cms
# mkdir /var/www/cms
# cp -r pref-shimane-cms-1.0.1/* /var/share/cms/

■chasen辞書の設定
——————————————————————————–
# sudo -u www-data make
/usr/lib/chasen/makeda user chimei.dic custom.dic
make: /usr/lib/chasen/makeda: Command not found
make: *** [user.da] Error 127

Makefile内の makeda のパスを次のように変更してから再度実行
2c2
< /usr/local/chasen/libexec/chasen/makeda user $^

> /usr/lib/chasen/makeda user $^

# sudo -u www-data make
/usr/local/chasen/libexec/chasen/makeda user chimei.dic custom.dic
parsing /usr/local/chasen/lib/chasen/dic/ipadic/grammar.cha
parsing /usr/local/chasen/lib/chasen/dic/ipadic/cforms.cha
parsing /usr/local/chasen/lib/chasen/dic/ipadic/table.cha
parsing dictionaries...
chimei.dic
custom.dic
1509 entries
1497 keys

chasenの辞書directoryにユーザ辞書へのsymlinkを作成する
# ln -s /var/share/cms/dict/user.* /usr/local/chasen/lib/chasen/dic/ipadic/

■kakasiのインストール
——————————————————————————–
# wget http://kakasi.namazu.org/stabl......3.4.tar.gz
# tar zxvf kakasi-2.3.4.tar.gz
# cd kakasi-2.3.4
# ./configure
# make
# make install

★Ruby/KAKASI 拡張モジュールのインストール
# wget http://www.notwork.org/~gotoke......928.tar.gz
# tar zxvf kakasi-020928.tar.gz
# cd kakasi-020928
# ruby extconf.rb
# make
# make install

■画像処理関係- ImageMagick, rmagick, gd 等のインストール
——————————————————————————–
★たくさんの依存関係パッケージが必要ため、パッケージインストールを先に行った方が賢明

# yum install ImageMagick-devel

★ rmagick のインストール

# gem install rmagick
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install rmagick
checking for Ruby version >= 1.8.2... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... no
Can’t install RMagick 2.2.2. You must have ImageMagick 6.3.0 or later.

★ImageMagickはバージョン6.3.0以降が必要

# wget ftp://zoffy.asahi-net.or.jp/pu......5-9.tar.gz
# tar zxvf ImageMagick-6.3.5-9.tar.gz
# cd ImageMagick-6.3.5
# ./configure
# make
# make install

★rmagick のインストールを再度実行(今回は成功した)

# gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.2.2

★gd と Ruby/GD のインストール

# yum install gd-devel
# gem install ruby-gd

■Postgresqlのインストールとデータベースの設定
——————————————————————————–
★先にインストールしておく
# yum install bison
# yum install flex

★便利なreadlineを使ってみよう
# wget ftp://ftp.cwru.edu/pub/bash/re......5.2.tar.gz
# tar zxvf readline-5.2.tar.gz
# cd readline-5.2
# ./configure
# make
# make install

# ldconfig

★開発用ヘッダファイルなどを含む、readline-develパッケージもインストールする必要がある
# yum install readline-devel
# yum install ncurses-devel

# wget ftp://ftp.jp.postgresql.org/so......3.0.tar.gz
# tar zxvf postgresql-8.3.0.tar.gz
# cd postgresql-8.3.0
# ./configure
# gmake

2時間以上も終わらなかったので、次の1行からループしているみたい。
cd . && ./config.status –recheck
running /bin/sh ./configure –without-readline –no-create –no-recursion

★どのpostgresのパッケージがインストールされているかを調べてみる。
# rpm -qa | grep postg

★どんなサービスが起動だれているかを確認する。
# netstat -a | grep LISTEN

★★ パッケージインストールで試してみる ★★
# yum install postgresql
# yum install postgresql-devel
# yum install postgresql-server

# find / -name postgres*
/etc/rc.d/init.d/postgresql
/etc/pam.d/postgresql

★ postgresql を起動させる
参考URL: http://www.flmnh.ufl.edu/linux......gresql.htm

# /sbin/chkconfig postgresql on
# /sbin/service postgresql start

Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log’: File exists
[FAILED]
Starting postgresql service: [FAILED]

★別の方法でやってみることにした
参考URL: http://108bones.blog71.fc2.com......y-137.html

# su - postgres
$ initdb -D /var/lib/pgsql/data

The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.

initdb: directory “/var/lib/pgsql/data” exists but is not empty
If you want to create a new database system, either remove or empty
the directory “/var/lib/pgsql/data”
or run initdb
with an argument other than “/var/lib/pgsql/data”.

/var/lib/pgsql/data というフォルダを削除したらうまくいった。

$ initdb -D /var/lib/pgsql/data
Success. You can now start the database server using:

postmaster -D /var/lib/pgsql/data
or
pg_ctl -D /var/lib/pgsql/data -l logfile start

★サービスを再度起動する

# /sbin/service postgresql start
Starting postgresql service: [ OK ]

★データベースユーザの作成

$ createuser www-data
Shall the new role be a superuser? (y/n) y
CREATE ROLE

$ dropuser www-data
DROP ROLE

★間違った作成なので、ユーザを削除してからやりなおす

$ createuser www-data
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE

★データベースの作成

$ sudo -u www-data createdb -U www-data cms_test -EUNICODE
$ sudo -u www-data createdb -U www-data cms_development -EUNICODE
$ sudo -u www-data createdb -U www-data cms_production -EUNICODE

★install a pure Ruby postgres driver
# gem install postgres-pr

■Webサーバの設定
——————————————————————————–
★httpd.confの設定変更
$ cd /etc/httpd/conf
$ sudo vi httpd.conf

★8000番ポートに変更
#——————————————————————
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
#Listen 80
Listen 8000
#——————————————————————
★そして、/var/share/cms/doc/apache2.conf.exampleの内容を追加
#——————————————————————
NameVirtualHost *:8000

<VirtualHost *:8000>
ServerAdmin root@localhost.localdomain
ServerName cms.netlab.jp

DocumentRoot /var/www/cms
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

RewriteEngine On
RewriteRule (.*)/$ $1/index.html

# for mobile
RewriteCond %{HTTP_USER_AGENT} (DoCoMo|J-PHONE|Vodafone|WILLCOM|MOT\-|UP\.Browser|
DDIPOCKET|ASTEL|PDXGW|Palmscape|Xiino|sharp\ pda\ browser|Windows\ CE|L\-mode)
RewriteRule (.*\.html)$ $1.i [L]

# for UD
RewriteCond %{HTTP_COOKIE} css=hc
RewriteRule ^/stylesheets/color.css /stylesheets/hc.css [L]
RewriteCond %{HTTP_COOKIE} css=lc
RewriteRule ^/stylesheets/color.css /stylesheets/lc.css [L]
RewriteCond %{HTTP_COOKIE} ruby=on
RewriteRule (.*\.html)$ $1.r [L]
RewriteCond %{HTTP_COOKIE} ruby=off
RewriteRule (.*/)index\.html\.r$ $1 [L]
RewriteCond %{HTTP_COOKIE} ruby=off
RewriteRule (.*\.html)\.r$ $1 [L]

ErrorLog /var/log/httpd/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/httpd/access.log combined
ServerSignature On

# directroy for enquete form cgi
ScriptAlias /cgi-bin/ /var/share/cms/cgi-bin/
<Directory /var/share/cms/cgi-bin>
AllowOverride None
Options ExecCGI
Order deny,allow
deny from all
Allow from 127.0.0.1
<Files “enquete.cgi”>
Order deny,allow
allow from all
</Files>
</Directory>

</VirtualHost>
#——————————————————————

★apacheの再起動
# /usr/sbin/apachectl restart

■lighttpdのインストール
参考URL: http://centos.oss.sc/ruby/apac......tpd_rails/
——————————————————————————–
★まずは fastcgiのインストール

# wget http://www.fastcgi.com/dist/fc......4.0.tar.gz
# tar zxvf fcgi-2.4.0.tar.gz
# cd fcgi-2.4.0
# ./configure
# make
# make install
# gem install fcgi

★lighttpdのインストールへ続く
# yum –enable=rpmforge install lighttpd
Loading “installonlyn” plugin

Error getting repository data for rpmforge, repository not found

★新規に RPMforge リポジトリを rpm でインストール
参考URL: http://centos.oss.sc/fundament......_rpmforge/

# wget http://dag.wieers.com/packages......f.i386.rpm
# rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# vi /etc/yum.repos.d/rpmforge.repo

★無用の混乱を避けるため、デフォルトでは有効にならないように設定ファイルを修正する
#————————–
#enabled = 1
enabled = 0
#————————–

★次に RPM の署名を検証するためのキーを導入
# wget http://dag.wieers.com/packages......EY.dag.txt
# rpm –import RPM-GPG-KEY.dag.txt

これで設定は完了です。前述の通りデフォルトでは有効にならないので、RPMforge のリポジトリを使いたい場合は以下のように「–enablerepo=rpmforge」をつけます。

# yum –enable=rpmforge install lighttpd
# yum –enable=rpmforge install lighttpd-fastcgi

■■■本プログラムの設定■■■
# cd /var/share/cms
# cd config
# sudo -u www-data cp cms.yml.example cms.yml
# sudo -u www-data vi cms.yml

————————————
# for notify mails
:mail_domain: localhost.localdomain
————————————

★ public.の中には公開サーバへsyncするためのファイルが置かれる
# sudo -u www-data mkdir public.
# sudo -u www-data ln -s ./public/stylesheets ./public/javascripts ./public/config.html* ./public/images ./public./
# cd ../config
# sudo -u www-data cp database.yml.example database.yml
# sudo -u www-data vi database.yml

username: postgres

★データベースに初期データを投入
# sudo -u www-data rake migrate

★データベースにsessionテーブルを作成
# sudo -u www-data rake create_sessions_table

■■ 音声合成プログラムの設定
音声合成プログラムgtalk, chaoneをコンパイルする。

# cd /var/share/cms/tool/gtalk/gtalk
# sudo -u www-data ./configure
# sudo -u www-data make

前提条件
# yum install libxml2
# yum install libxml2-devel
# yum install libxslt-devel

# cd /var/share/cms/tool/gtalk/morph/chaone-1.2.0
# sudo -u www-data ./configure

# sudo -u www-data make

■■ exportの設定

CMSで作成したcontentsを公開サーバにuploadするスクリプトの設定およびsyncの設定を行います。 /var/share/cms/tool/exportの以下の箇所を変更します。(line:57 あたり)

# cd /var/share/cms
# sudo -u www-data vi tool/export

SERVER = [’localhost‘] <== 公開サーバのドメイン
USER = ‘www-data‘ <== 公開サーバにrsyncするユーザ

公開サーバにrsyncするユーザのssh鍵を公開サーバの同名のユーザの ~/.ssh/authorized_keysに登録します。ここでは、アプリケーションサーバと公開サーバが同じマシンであるとして、設定方法が説明されています。

* rsyncユーザのssh鍵を作成します。(ここではwww-userとします) 鍵を作成するときパスフレーズは空にします。

# sudo -u www-data ssh-keygen -t rsa
・・・中略・・・
Your identification has been saved in /home/www-data/.ssh/id_rsa.
Your public key has been saved in /home/www-data/.ssh/id_rsa.pub.
The key fingerprint is:
42:7d:ff:32:f0:a5:fd:d9:05:7c:8c:f9:5e:e7:9b:1f www-data@localhost.localdomain

* rsyncユーザの鍵を公開サーバのユーザのホームdirectoryの.ssh/authorized_keysに登録します。

# sudo -u www-data sh -c ‘cat /home/www-data/.ssh/id_rsa.pub >> /home/www-data/.ssh/authorized_keys’

■■ cronの設定

www-dataユーザのcronの設定を行います。
doc/crontab.exampleの内容を確認しcrontabに反映させます。これらのjob中では、cmsで作成されたページの内容を静的なhtmlファイルとして書き出し、それらを公開サーバのdoc rootにsyncすることを行っています。

# sudo -u www-data crontab doc/crontab.example

do_exportファイルが作成することによって静的なhtmlファイルが作成されます。

# sudo -u www-data touch /var/share/cms/do_export

do_syncファイルが作成することによってファイルが公開サーバのdocument rootにrsyncされます。

# sudo -u www-data touch /var/share/cms/do_sync

上記のファイルを削除すると静的ページの作成や、公開サーバへのsyncが行なわれません。

■■ アンケート機能の設定

CMSではアンケートフォーム付きのページを作成することができます。そして、閲覧者がアンケートに回答した結果を確認する機能があります。

アンケート機能を利用するにはenqueteの回答を公開サーバに保存するcgiプログラムの設定と、公開サーバに保存された回答結果をアプリケー ションサーバに転送するための設定が必要になります。なお、アンケートの回答結果はGPGにより暗号化して公開サーバからアプリケーションサーバに転送さ れます。

(0)GPG鍵を作成します。cms(アプリケーションサーバが動作するマシン)で以下のコマンドを実行しGPG鍵を作成します。

# sudo -H -u www-data gpg –gen-key

# sudo mkdir /var/www/.gnupg
# sudo chown www-data:www-data /var/www/.gnupg
# sudo -u www-data chmod go-xwr /var/www/.gnupg

(0) アプリケーションサーバにフォームデータの受け取り用のSSH鍵を生成します。

* アプリケーションサーバで以下のコマンドを実行しSSH鍵を作成します。
(passphraseなしでRSAタイプのid_rsa_enqueteという鍵を作成します。)

# sudo -H -u www-data ssh-keygen -t rsa -N ” -f /home/www-data/.ssh/id_rsa_enquete
Generating public/private rsa key pair.
Your identification has been saved in /home/www-data/.ssh/id_rsa_enquete.
Your public key has been saved in /home/www-data/.ssh/id_rsa_enquete.pub.
The key fingerprint is:
38:96:bf:72:40:3c:4f:d0:f4:d3:7c:ed:a9:56:1c:12 www-data@localhost.localdomain

(0) GPG鍵とフォームデータ受け取り用SSH鍵の公開鍵を公開サーバに転送します。

* アプリケーションサーバで以下のコマンドを実行し公開鍵を転送します。(ホスト名は使用環境に合わせて変更してください)

# sudo -H -u www-data gpg –export –armor www-data@localhost.localdomain
—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.4.5 (GNU/Linux)

mQGiBEbKVb8RBACoEnYZAvNZbSYo52aF0/DXgsw5bbe+NOnTc2Ck8YJszJ1jmkdy
・・・中略・・・
—–END PGP PUBLIC KEY BLOCK—–

★上記内容を /tmp/pgp.pub に保存しておかないといけないのかな?

# scp -p /tmp/pgp.pub localhost.localdomain:/tmp/pgp.pub
The authenticity of host ‘localhost.localdomain (127.0.0.1)’ can’t be established.
RSA key fingerprint is 2d:83:eb:e3:8b:90:31:f2:db:61:e2:c2:9d:f8:b5:50.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘localhost.localdomain’ (RSA) to the list of known hosts.
root@localhost.localdomain’s password:
Permission denied, please try again.
root@localhost.localdomain’s password:
/tmp/pgp.pub: No such file or directory

公開サーバとは別サーバのことかと思いますが、同一サーバの場合はどうすればいいかわからなくて、とりあえずGPG鍵の設定を飛ばして、先へ進む。

########################
■■ プログラムの動作テスト
########################
・この時点で、コンパイルエラーがなくなったものの、実行エラーが存在する。(日付は狂って過去の時間になっているから?)

# cd /var/share/cms
# sudo -u www-data rake
・・・中略・・・
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
Started
........................................................F...................................................
Finished in 5.641434 seconds.

1) Failure:
test_date(PageContentTest) [./test/unit/page_content_test.rb:45]:
<Thu Jan 05 10:00:00 -0500 2006> expected but was
<Wed Jan 04 20:00:00 -0500 2006>.

108 tests, 277 assertions, 1 failures, 0 errors
・・・中略・・・
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
Started
.................................................F............................updating: var/share/cms/config/../public/config.html (deflated 66%)
...............................................................
Finished in 16.570894 seconds.

1) Failure:
test_page_status(AdminControllerTest) [./test/functional/admin_controller_test.rb:1524]:
<”Sun Mar 12 00:00:00 +0900 2006″> expected but was
<”Sun Mar 12 00:00:00 -0500 2006″>.

141 tests, 935 assertions, 1 failures, 0 errors

########################
■■ プログラムの起動
########################

lighttpdを起動するとプログラムが起動します。

# cd /etc/init.d
# ./lighttpd start
Starting lighttpd: [ OK ]
2008-02-28 17:51:10: (mod_fastcgi.c.999) execve failed for: /var/share/cms/public/dispatch.fcgi No such file or directory
[root@localhost init.d]# 2008-02-28 17:51:10: (mod_fastcgi.c.1025) the fastcgi-backend /var/share/cms/public/dispatch.fcgi failed to start:
2008-02-28 17:51:10: (mod_fastcgi.c.1029) child exited with status 2 /var/share/cms/public/dispatch.fcgi
2008-02-28 17:51:10: (mod_fastcgi.c.1032) If you’re trying to run PHP as a FastCGI backend, make sure you’re using the FastCGI-enabled version.
You can find out if it is the right one by executing ‘php -v’ and it should display ‘(cgi-fcgi)’ in the output, NOT ‘(cgi)’ NOR ‘(cli)’.
For more information, check http://trac.lighttpd.net/trac/......-programIf this is PHP on Gentoo, add ‘fastcgi’ to the USE flags.
2008-02-28 17:51:10: (mod_fastcgi.c.1336) [ERROR]: spawning fcgi failed.
2008-02-28 17:51:10: (server.c.895) Configuration of plugins failed. Going down.

★確認してみると、やはりだめです。

# php -v
PHP 5.1.6 (cli) (built: Mar 14 2007 18:56:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

★lighttpd の再インストール

# wget http://www.lighttpd.net/downlo.......18.tar.gz
# tar zxvf lighttpd-1.4.18.tar.gz
# cd lighttpd-1.4.18
# ./configure –enable-fastcgi –enable-force-cgi-redirect
# make
# make install

何も変わりません。

★lighttpd.conf はエラーがあるかどうかをチェック

# lighttpd -f /etc/lighttpd/lighttpd.conf
can’t handle ‘$HTTP[cookie] =~ ...’ as you compiled without pcre support.
(perhaps just a missing pcre-devel package ?)
2008-02-29 13:47:12: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 218 pos: 3 parser failed somehow near here: {

★対策:pcre-develのインストール

# yum install pcre-devel

★別方法で試してみる
# ruby /var/share/cms/script/process/spawner -p 7000
Starting FCGI on port: 7000
sh: /var/share/cms/public/dispatch.fcgi: /usr/bin/ruby1.8: bad interpreter: No such file or directory
sh: /var/share/cms/public/dispatch.fcgi: Success
spawn-fcgi.c.207: child exited with: 1, Operation not permitted
Starting FCGI on port: 7001
sh: /var/share/cms/public/dispatch.fcgi: /usr/bin/ruby1.8: bad interpreter: No such file or directory
sh: /var/share/cms/public/dispatch.fcgi: Success
spawn-fcgi.c.207: child exited with: 1, Operation not permitted
Starting FCGI on port: 7002
sh: /var/share/cms/public/dispatch.fcgi: /usr/bin/ruby1.8: bad interpreter: No such file or directory
sh: /var/share/cms/public/dispatch.fcgi: Success
spawn-fcgi.c.207: child exited with: 1, Operation not permitted

★問題の個所をコメントアウトしてみる

218行目~
##$HTTP[”cookie”] =~ “css=hc” {
## url.rewrite-once = ( “/stylesheets/color.css” => “/stylesheets/hc.css” )
##}
##$HTTP[”cookie”] =~ “css=lc” {
## url.rewrite-once = ( “/stylesheets/color.css” => “/stylesheets/lc.css” )
##}


##$HTTP[”cookie”] =~ “ruby=on” {
## url.rewrite-once = ( “^/config\.html$” => “config.html.r” )
##}

★再度エラーチェック

# lighttpd -f /etc/lighttpd/lighttpd.conf
# 2008-02-29 14:05:53: (mod_fastcgi.c.999) execve failed for: /var/share/cms/public/dispatch.fcgi No such file or directory
2008-02-29 14:05:53: (mod_fastcgi.c.1025) the fastcgi-backend /var/share/cms/public/dispatch.fcgi failed to start:
2008-02-29 14:05:53: (mod_fastcgi.c.1029) child exited with status 2 /var/share/cms/public/dispatch.fcgi
2008-02-29 14:05:53: (mod_fastcgi.c.1032) If you’re trying to run PHP as a FastCGI backend, make sure you’re using the FastCGI-enabled version.
You can find out if it is the right one by executing ‘php -v’ and it should display ‘(cgi-fcgi)’ in the output, NOT ‘(cgi)’ NOR ‘(cli)’.
For more information, check http://trac.lighttpd.net/trac/......-programIf this is PHP on Gentoo, add ‘fastcgi’ to the USE flags.
2008-02-29 14:05:53: (mod_fastcgi.c.1336) [ERROR]: spawning fcgi failed.
2008-02-29 14:05:53: (server.c.895) Configuration of plugins failed. Going down.

★/var/share/cms/public/dispatch.fcgiのrubyパスを次のように変更

#!/usr/bin/ruby1.8

#!/usr/local/bin/ruby

# /etc/init.d/lighttpd start
Starting lighttpd: [ OK ]
# 2008-02-29 14:27:13: (mod_accesslog.c.535) opening access-log failed: Permission denied /var/log/lighttpd/access.log
2008-02-29 14:27:13: (server.c.895) Configuration of plugins failed. Going down.
ruby: SIGTERM (SignalException)

★ディレクトリのオーナーを変更

# chown -R www-data:www-data lighttpd
# /etc/init.d/lighttpd start

Starting lighttpd: [ OK ]

=>やっと無事起動できました。

★iptables を止めたら、ブラウザでホームページを表示できるようになった。

[root@localhost init.d]# ./iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]

★管理者ログイン画面

http://localhost/_admin/

★アンケートの設定はまだできていないので、エラー

http://localhost/_enquete/list
# Warning: Identity file /var/share/www/.ssh/id_rsa_enquete not accessible: No such file or directory.
Host key verification failed.

コメント

(必須)

(必須)
(メールアドレスは公開されません)