Installing Ruby on Rails with Lighttpd and MySQL and FastCGI on CentOS 4
CentOS4.3でLighttpd + rails +FastCGIを構築したのでメモ。
rubyインストール
# cd /etc/yum.repos.d/
# wget http://dev.centos.org/centos/4/CentOS-Testing.repo
# yum -y --enablerepo=c4-testing install ruby ruby-docs ruby-ri ruby-libs ruby-mode ruby-tcltk ruby-rdoc ruby-devel ruby-irb
gemインストール
# wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
# tar -xzf rubygems-0.9.tgz
# cd rubygems-0.9
# ruby setup.rb
fastcgiインストール
# wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
# tar zxvf fcgi-2.4.0.tar.gz
# cd fcgi-2.4.0
# ./configure
# make
# make install
fastcgi for rubyインストール
# gem install fcgi
# vi /etc/ld.so.conf
/usr/local/lib
# /sbin/ldconfig
# ldconfig -v | grep libfcgi"
libfcgi.so.0 -> libfcgi.so.0.0.0
MySQLインストール
# yum -y install mysql-server mysql mysql-devel emacs-common
# vi /etc/my.cnf
old_password=0
# mysql -u root -p
SET PASSWORD FOR root@localhost=PASSWORD('password');
use mysql;
delete from user where user='';
GRANT ALL PRIVILEGES ON lian_production.* TO lian@localhost IDENTIFIED BY 'lian';
FLUSH PRIVILEGES;
my.cnfは後で設定。
Lighttpdインストール
# cd /usr/local/src
# wget http://www.lighttpd.net/download/lighttpd-1.4.13-1.i386.rpm
# rpm -i lighttpd-1.4.13-1.i386.rpm
# vi /etc/lighttpd/lighttpd.confserver.port = 80
server.modules = ( "mod_rewrite", "mod_fastcgi" )
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
server.error-handler-404 = "/dispatch.fcgi"
server.document-root
index-file.names = ( "index.html", "index.htm", "index.rhtml" )
server.errorlog = "/var/log/httpd/error.log"
accesslog.filename = "/var/log/httpd/access.log"
server.username = "www"
server.groupname = "www"
fastcgi.server = ( ".fcgi" =>
( "localhost" =>
(
"min-procs" => 1,
"max-procs" => 5,
"socket" => "/tmp/application.fcgi.socket",
"bin-path" => "document-root/RAILS_ROOT/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ROOT" => "/document-root",
"RAILS_ENV" => "development" )
)
)
)server.follow-symlink = "enable" => apache Options FollowSymLinks
server.dir-listing = "disable" => apache Option Indexes