Rails2.0 + Lighttpd + CentOS5の環境構築での問題


Apache + lighttpd で Rails を動かす
を参考にして、Railsアプリの実行環境を構築していたところ、僕の環境ではなぜか問題が発生したのでメモ。僕の環境は、以下のとおり。

各アプリのインストールは上記サイトの通りにやって順調に行ってたのだが、いざlighttpdを実行しようとすると、

2008-05-11 15:37:35: (log.c.75) server started
2008-05-11 15:37:35: (mod_fastcgi.c.1029) the fastcgi-backend /var/lighttpd/demo/public/dispatch.fcgi failed to start:
2008-05-11 15:37:35: (mod_fastcgi.c.1033) child exited with status 9 /var/lighttpd/demo/public/dispatch.fcgi
2008-05-11 15:37:35: (mod_fastcgi.c.1036) 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/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-programIf this is PHP on Gentoo, add '
fastcgi' to the USE flags.
2008-05-11 15:37:35: (mod_fastcgi.c.1340) [ERROR]: spawning fcgi failed.
2008-05-11 15:37:35: (server.c.908) Configuration of plugins failed. Going down.
こんなエラーを吐いてlighttpdが終了してしまう。ネットで調べてもイマイチ原因がわからない。ならば development モードでやったらどうかと思って、Railsのプロジェクトディレクトリで以下のコマンドをたたく。

# ruby script/server lighttpd
するとあっさりと動いた。はて???

ということは、Railsで生成したconf/lighttpd.confを使えば良いのか、と思って /etc/lighttpd/lighttpd.conf を置き換えてみると、、、

動いた。

元のlighttpd.confと、Railsで生成したlighttpd.conf との違いは良く分からなかったが(設定内容はだいたい同じはずなのだが)、とりあえずやりたいことは実現できてるので良しとしよう。