本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7575538
建立时间:2006年5月29日




[Ruby on Rails]Rails虚拟主机配置方案
软件技术

lhwork 发表于 2007/2/11 19:49:22

算是我的第一篇比较正规的原创内容,:) 以Ubuntu 6.06为例,服务器为Lighttpd 1。安装Ruby sudo apt-get install ruby irb rdoc 2。安装Ruby Gems 在http://rubyforge.org/projects/rubygems/下载,解压ruby setup.rb 3。安装Rails sudo gem install -y rails 4。安装Lighttpd sudo apt-get install lighttpd 5。安装FastCGI sudo apt-get install libfcgi-dev libfcgi-ruby1.8 开个irb看看是否安装成功 henry@henry-laptop:~$ irb irb(main):001:0> require ‘fcgi’ => true irb(main):002:0> 6。开始配置服务器 server.modules = ( “mod_rewrite”, “mod_accesslog”, “mod_fastcgi”) server.port = 80 #server.username = “username” #server.groupname = “groupname” server.pid-file = “/var/run/lighttpd.pid” accesslog.filename = “/var/log/lighttpd/access_log” server.errorlog = “/var/log/lighttpd/error_log” server.indexfiles = ( “index.html” ) mimetype.assign = ( “.css”     => “text/css”, “.gif”     => “image/gif”, “.htm”     => “text/html”, “.html”     => “text/html”, “.jpeg”     => “image/jpeg”, “.jpg”     => “image/jpeg”, “.js”       => “text/javascript”, “.png”     => “image/png”, “.swf”     => “application/x-shockwave-flash”, “.txt”     => “text/plain” ) # Making sure file uploads above 64k always work when using IE or Safari # For more information, see http://trac.lighttpd.net/trac/ticket/360 $HTTP[”useragent”] =~ “^(.*MSIE.*)|(.*AppleWebKit.*)$” { server.max-keep-alive-requests = 0 } $HTTP[”host”] == “www.firstapp.com” { server.document-root = “/var/www/firstapp/public” url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” => “$1.html” ) server.error-handler-404 = “/dispatch.fcgi” fastcgi.server = ( “.fcgi” => ( “localhost” => ( “min-procs” => 2, “max-procs” => 2, “socket” => “/tmp/firstapp.fcgi.socket”, “bin-path” => “/var/www/firstapp/public/dispatch.fcgi”, “bin-environment” => ( “RAILS_ENV” => “production” ) ) ) ) } $HTTP[”host”] == “www.secondapp.com” { server.document-root = “/var/www/secondapp/public” url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” => “$1.html” ) server.error-handler-404 = “/dispatch.fcgi” fastcgi.server = ( “.fcgi” => ( “localhost” => ( “min-procs” => 2, “max-procs” => 2, “socket” => “/tmp/secondapp.fcgi.socket”, “bin-path” => “/var/www/secondapp/public/dispatch.fcgi”, “bin-environment” => ( “RAILS_ENV” => “production” ) ) ) ) } 如果要是部署Rails虚拟主机可能会用代理,这样就可以不重启整个Web服务器来更新其中的一个Rails应用了,不过用代理没什么需要配置的,只要给每个Rails应用开个不同的端口,用一个Lighttpd做前台就可以了。


阅读全文(4603) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.063 second(s), page refreshed 144778850 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号