具体的安装步骤就不重复说了,相关的资料一大把。
但是怎么样把Rails应用跑起来,我还折腾了一番,最后发现linux下的权限引起的。
我在Ubuntu下遇到的问题是Ligttpd可以启动,可以具体的rails应用却没有起来,可以
ps -ef | grep fcgi看看fastcgi进程是否起动了。
server.modules = (
"mod_access",
"mod_fastcgi",
"mod_rewrite",
"mod_accesslog"
)
server.document-root = "/home/qichunren/code/demo/public"
server.port=8888 # web server端口
server.error-handler-404 = "/dispatch.fcgi"
server.errorlog = "/home/qichunren/code/demo/log/error.log"
accesslog.filename = "/home/qichunren/code/demo/log/access.log"
fastcgi.server = (".fcgi" =>
("localhost" =>
("min-procs" => 10,
"max-procs" => 10,
"socket" => "/home/qichunren/code/demo/tmp/sockets/rails.socket",
"bin-path" => "/home/qichunren/code/demo/public/dispatch.fcgi"
)
)
)
#!/bin/sh
case "$1" in
start)
/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1
;;
stop)
killall lighttpd
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: lighttpd.sh {start|stop|restart}"
;;
esac
exit 0
我启动了10个fcgi进程,这10个fcgi进程是由Lighttpd服务器启动的时候顺带启动的,不用我们来启动,这里有里有一个技巧,就是重启web server的时候不用关掉Lighttpd,而是将fcgi进程都kill掉,Lighttpd会自动监视fcgi进程的,看到没有了就会再次启动fcgi进程,所以一个shell就可以搞定重启:
#!/bin/bash
ps aux | grep dispatch.fcgi | egrep -v grep | awk '{print $2}' | xargs kill -9