lighttpdインストールと配置


オペレーティングシステム:Ubuntu 9.10
 
セットアップは基本的にhttp://www.lighttpd.com.cn/?p=56です。 紹介してくれたのは、ルビーライズのmysqlをインストールする部分を省略しました。
 
1.インストールfcgiから開始する
 
http://www.fastcgi.com/dist/
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=/usr/local/system/fcgi
make && make install
 
2.fcgiのルビーサポートライブラリをインストールする
 
http://rubyforge.org/projects/fcgi/
tar xzvf ruby-fcgi-0.8.7.tar.gz
cd ruby-fcgi-0.8.7
ruby install.rb config -- --with-fcgi-include=/usr/local/system/fcgi/include --with-fcgi-lib=/usr/local/system/fcgi/lib
ruby install.rb setup
ruby install.rb install
 
3.lighttpdの取り付け
 
http://www.lighttpd.net/download/
tar xzvf lighttpd-1.4.13.tar.gz
cd lighttpd-1.4.13
./configure --prefix=/usr/local/system/lighttpd
configure    ,                    ,      ,              
, enable        “mod_rewrite”   ,      pcre    。      :
make && make install
 :         pcre    。    pcre   。
 
   備考:pcreをインストールする
 
   wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.zip
unzip pcre-7.8.zip
cd pcre-7.8
./configure --enable-utf8 --enable-unicode-properties
make
make install
 
 
4.lighttpdの設定
 
mkdir /etc/lighttpd
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf

      
vi /etc/init.d/lighttpd


#!/bin/sh

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH

case $1 in

start)
/usr/local/system/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1
echo "started!"
;;
stop)
killall lighttpd
echo "lighttpd stopped"
;;
restart)
$0 stop
echo "hah"
$0 start
;;
*)
echo "Usag $0 [start|stop|restart]"
;;
esac

exit 0

 
 
5.修正/etc/lighttpd/lighttpd.com nf
 
1.            ,mod_rewrite,mod_access,mod_fastcgi,mod_simple_vhost,mod_cgi,mod_compress,mod_accesslog        。
 
 2.server.document-root = "/rails_app/" server.errorlog = "/rails_app/log/lighttpd/error.log" 
 
3.commpress.cache-dir=「/tmp/lightpd/cache/comppress」璣自分で新規作成/tmp/lightpd/cache/comppressフォルダ
compress.filetype=(”text/plain”, “text/html”,”text/javascript”,”text/css”)
   
4.  ruby on rails
        :
$HTTP["host"] == “www.xxx.com” {
server.document-root = “/yourrails/public”
server.error-handler-404 = “/dispatch.fcgi”
fastcgi.server = (”.fcgi” =>
(”localhost” =>
(”min-procs” => 10,
“max-procs” => 10,
“socket” => “/tmp/lighttpd/socket/rails.socket”, #      lighttpd/socket    
“bin-path” => “/yourrails/public/dispatch.fcgi”,
“bin-environment” => (”RAILS_ENV” => “production”)
)
)
)
}
 
 
 
配置が完了しました。lighttpdを起動しました。切ったら、なんとLIls_。アプリ/publicの下にはありません。 dispatch.fcgi、googleは、RAls 2.3が自動的に生成されなくなりました。コマンドで生成する必要があります。 
 
rake rails:update:generate_dispatchers

(rails 2.3.5)
 
再度起動しても、まだ起動されていません。エラーを報告します。
 
child exited with status 2
 再度Google、今回の問題は比較的に手を焼いて、多く探して解決方法を発見していません。無意識のうちに、ある仁兄の返事によると、システムはfcgiパスを見つけていないかもしれません。環境変数が配置されていないかもしれません。
 
 vi/ect/enviroment
 
 PATHの後ろにfcgiの経路を書きます。source/etc/enviroment。
 
再起動、大成功!
 
 
 
ちょっと残念ですが、そのシナリオはスタートしてもstartもstopも効きますが、retartはあまり役に立たないです。研究中…