Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
litespeed_wiki:other-ext-apps:ruby-rails-old [2015/07/28 20:43]
Michael Alegre created
litespeed_wiki:other-ext-apps:ruby-rails-old [2017/04/20 23:06]
Michael Alegre [Requirements]
Line 1: Line 1:
-====== Ruby On Rails with LiteSpeed Web Server (Old Method) ​======+====== Ruby On Rails Detailed Step by Step Manual Configuration ​====== 
 +**This tutorial is outdated, please use [[litespeed_wiki:​other-ext-apps:​ruby-on-rails-easy-config|Ruby on Rails Easy Configuration]] or [[litespeed_wiki:​other-ext-apps:​rails-shared-hosting|Rails Shared Hosting Configuration]]** 
 +===== Introduction ​=====
  
-Visit [[litespeed_wiki:​ruby_rails| Ruby on Rails with LSWS (New Method)]] for the new easier way of binding Ruby on Rails apps to LiteSpeed server. +LiteSpeed web server is one of the best and easiest ​platform for large scale Ruby On Rails application ​deployment. There are five options to setup Rails application with LiteSpeed ​server: 
- +  * Ruby LiteSpeed API (Ruby LSAPI)
-===== Introduction ===== +
-LiteSpeed web server is one of the best platform for large scale RubyOnRails ​application ​deployments. There are five options to setup Rails application with LiteSpeed ​Web Server. +
-They are  +
-  * Ruby LiteSpeed API+
   * LiteSpeed RubyRunner (Run CGI in persistent interpreter like mod_perl to perl)   * LiteSpeed RubyRunner (Run CGI in persistent interpreter like mod_perl to perl)
   * FastCGI   * FastCGI
Line 12: Line 10:
   * CGI   * CGI
  
-Pure CGI mode is not recommended as it is painly ​slow. FastCGI is much better as the ruby interpreter stay persistent, however, the ruby FCGI module does not support persistent FCGI connection, which does not bring the best performance out of LiteSpeed'​s FastCGI interface. ​+Pure CGI mode is not recommended as it is plainly ​slow. FastCGI is much better as the ruby interpreter stay persistent, however, the ruby FCGI module does not support persistent FCGI connection, which does not bring the best performance out of LiteSpeed'​s FastCGI interface. ​
  
 Mongrel is a fast HTTP server for ruby, it is much faster than WEBrick comes with Rails, but still pretty slow comparing to web servers written in C/C++. Rails running under mongrel has comparable performance to Rails running as FastCGI, just slightly slower. Mongrel is easy to use as it does not require extra configuration,​ just start it under the root directory of your Rails application. However, its performance on serving static content is poor, so it is better to have a high performance web server sitting in front of mongrel for that job. Mongrel has another weakness is that, you need to start multiple Mongrel instances to take advantage of multiple CPU in a SMP server, which may complicate the installation for high performance environment. With LiteSpeed'​s reliable high performance load balancing reverse proxy interface, LiteSpeed web server can be placed in front of either one mongrel or a mongrel cluster, let Mongrel serve dynamic pages generated by Rails and serving static pages cached in file system by Rails. ​ Mongrel is a fast HTTP server for ruby, it is much faster than WEBrick comes with Rails, but still pretty slow comparing to web servers written in C/C++. Rails running under mongrel has comparable performance to Rails running as FastCGI, just slightly slower. Mongrel is easy to use as it does not require extra configuration,​ just start it under the root directory of your Rails application. However, its performance on serving static content is poor, so it is better to have a high performance web server sitting in front of mongrel for that job. Mongrel has another weakness is that, you need to start multiple Mongrel instances to take advantage of multiple CPU in a SMP server, which may complicate the installation for high performance environment. With LiteSpeed'​s reliable high performance load balancing reverse proxy interface, LiteSpeed web server can be placed in front of either one mongrel or a mongrel cluster, let Mongrel serve dynamic pages generated by Rails and serving static pages cached in file system by Rails. ​
  
-In order to maximize the performance of a Rails application,​ we deveoped ​our own Ruby interface module using our LiteSpeed API protocol, LiteSpeed API, or LSAPI, is a highly optimized IPC protocol between LiteSpeed web server and a standalone process, which yields the best possible performance. LiteSpeed RubyRunner is an addon to Ruby LiteSpeed API, which allow running plain Ruby CGI under a persistent interpreter,​ it makes ruby CGI runs much faster, however it is not as fast as plain LSAPI CGI as ruby interpreter has done extra work to insolate ​the runtime ​environment of each CGI execution. ​ +In order to maximize the performance of a Rails application,​ we developed ​our own Ruby interface module using our LiteSpeed API protocol, LiteSpeed API, or LSAPI, is a highly optimized IPC protocol between LiteSpeed web server and a standalone process, which yields the best possible performance. LiteSpeed RubyRunner is an add-on ​to Ruby LiteSpeed API, which allow running plain Ruby CGI under a persistent interpreter,​ it makes ruby CGI runs much faster, however it is not as fast as plain LSAPI CGI as ruby interpreter has done extra work to insulate ​the run-time ​environment of each CGI execution. ​
  
  
 +LiteSpeed Web Server 2.2 and above provides a much easier way to configure a Rails application,​ which is highly recommended for simple Rails deployments,​ new wiki tutorial is [[litespeed_wiki:​other-ext-apps:​ruby-on-rails-easy-config|here]]. If you are interested in knowing how to hook up LiteSpeed web server with a Rails application step by step, read on. 8-)  ​
  
  
Line 26: Line 24:
 Before you can setup RubyOnRails with LiteSpeed Web Server you should have finished the following steps: Before you can setup RubyOnRails with LiteSpeed Web Server you should have finished the following steps:
   - Latest LiteSpeed Web Server has been installed (Very easy, just follow the document)   - Latest LiteSpeed Web Server has been installed (Very easy, just follow the document)
-  - RubyOnRails has been installed (Just follow instructions at [[http://www.rubyonrails.org/​down|www.rubyonrails.org/down]] +  - RubyOnRails has been installed (Just follow instructions at [[http://weblog.rubyonrails.org/​2017/​3/​20/​Rails-5-1-rc1/]] 
-  - Have a working Ruby application installation,​ such as [[http://​www.typosphere.org/​|Typo]],​ or a simple Hello World application like this [[http://​mentalized.net/​journal/​2006/​02/​06/​hello_ruby_on_rails_world/​|one]]+  - Have a working Ruby application installation,​ such as a simple Hello World application like this [[http://​mentalized.net/​journal/​2006/​02/​06/​hello_ruby_on_rails_world/​|one]].
-  - If you want to use [[http://​mongrel.rubyforge.org/​|mongrel]] as the backend, it should have been installed and working properly on its own.+
  
 ===== Rails with Ruby LiteSpeed API ===== ===== Rails with Ruby LiteSpeed API =====
Line 41: Line 38:
 Or, you can install from source code. Or, you can install from source code.
  
-1) Download Ruby LSAPI from [[http://​www.litespeedtech.com/​products/​lsapi/]].+1) Download Ruby LSAPI from [[https://​www.litespeedtech.com/index.php/products/litespeed-sapi/download]].
  
 2) Unpack. ​ 2) Unpack. ​
Line 51: Line 48:
  
  
-3) Install Ruby LSAPi+3) Install Ruby LSAPI
  
 <​code>​ <​code>​
Line 60: Line 57:
  
  
-4) Copy Ruby dispatch script for lsapi to Ruby application. Note that dispatch.lsapi must have executable permission ​priviledges ​for the litespeed server user.+4) Copy Ruby dispatch script for lsapi to the public folder of Ruby application. Note that dispatch.lsapi must have executable permission ​privilege ​for the litespeed server user.
  
 <​code>​ <​code>​
Line 77: Line 74:
 1) Create a Virtual Host (vhost) within LiteSpeed. For this howto, we will refer to this vhost as RubyVhost. 1) Create a Virtual Host (vhost) within LiteSpeed. For this howto, we will refer to this vhost as RubyVhost.
  
-2) If the Rails application is served from "​Document Root", set RubyVhost'​s "​Document Root" to your rails applicaton's "​public"​ directory.+2) If the Rails application is served from "​Document Root", set RubyVhost'​s "​Document Root" to your rails application's "​public"​ directory.
  
 <​code>​ <​code>​
Line 129: Line 126:
 This method can support multiple Rails application under one virtual host, just define a external application and LSAPI context for each application. This method can support multiple Rails application under one virtual host, just define a external application and LSAPI context for each application.
  
-6) There are two options this step, one is using a 404 handler, another one is to use rewirte ​rules. Using 404 handler is more efficient. For one Rails per virtual host setup. You can create a new "​Custom Error Pages" handler in in RubyVhost'​s "​General"​ tab.+6) There are two options this step, one is using a 404 handler, another one is to use rewrite ​rules. Using 404 handler is more efficient. For one Rails per virtual host setup. You can create a new "​Custom Error Pages" handler in in RubyVhost'​s "​General"​ tab.
  
 <​code>​ <​code>​
  • Admin
  • Last modified: 2017/04/20 23:06
  • by Michael Alegre