Thursday, April 24, 2008

rails2.0.2 fastcgi sqlite3 setup

# add below line to /etc/hosts
127.0.0.1 www.test.com

# add below green lines at the end of lighttpd.conf file


$HTTP["host"] == "www.test.com" {
server.document-root = "/Users/test/Sites/RubyOnRails/public"
server.errorlog = "/Users/test/Sites/lighttpd/logs/rails.lighttpd.error.log"
server.indexfiles = ( "dispatch.fcgi", "index.html" )
accesslog.filename = "/Users/test/Sites/lighttpd/logs/rails.access.log"
server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = ( ".fcgi" =>
( "localhost" =>
(
"socket" => "/tmp/rails-fastcgi.socket",
"bin-path" => "/Users/test/Sites/RubyOnRails/public/dispatch.fcgi",
"bin-environment" => ("RAILS_ENV" => "development"),
"max-procs" => 3,
"min-procs" => 1
)
)
)
}

wget http://www.sqlite.org/sqlite-3.5.8.tar.gz
tar zxvf sqlite-3.5.8.tar.gz
cd sqlite-3.5.8
./configure --prefix=/usr/local/sqlite358
make
sudo make install

# create db files under rails app db folder
cd /Users/test/Sites/RubyOnRails/db
/usr/local/sqlite358/bin/sqlite3 development.sqlite3
/usr/local/sqlite358/bin/sqlite3 test.sqlite3
/usr/local/sqlite358/bin/sqlite3 production.sqlite3

sudo gem install sqlite3-ruby

# restart lighttpd, and request url: http://www.test.com

No comments :