Ruby on Rails: Wiki install Tutorial

#3
multiple instances?

Thanks for posting these instructions. However, it isn't clear how to map different rails apps to different urls. For example:

server.host.com/typo serves 127.0.0.1:4000
server.host.com/tracks serves 127.0.0.1:4001

(Well, the instructions don't say anything about different port numbers. I'm coming from a Mongrel context. Also, the directions there mention Mongrel under Requirements:

If you want to use mongrel as the backend, it should have been installed and working properly on its own.

but then don't mention Mongrel again. How does Mongrel fit into the instructions that follow the Requirements? But the basic question remains: )

The instructions posted seem to allow only one app which is mapped to the root of the server. How can I instantiate several different apps located in different directories and publicly differentiate them by url rather than by port number?

Thanks for your help.

John Miller
 
Last edited:

xing

LiteSpeed Staff
#4
When using Mongrel with LiteSpeed, just think of Mongrel as a http proxy server. So create "proxy" external apps, and create "contexts" to map url to the correct "proxy"/mongrel backend.

There is a litespeed how-to on mongrel's website:

http://mongrel.rubyforge.org/docs/litespeed.html

Two things to note:

1) In the above how-to, initial request timeout is way too low. 1 second is not practical. 15-30 seconds is more like it unless you entire db is ram based.

2) Understand that Mongrel is a http server and much slower http server than litespeed. With this in mind, you do not want Mongrel to handle static images/css/etc. Create a static context in lsws with higher priority (lower number) context in lsws to point to the static files/folders so that LiteSpeed handle all static content while only dynamic rail requests is routed to Mongrel backend.

We will update our wiki for sure.
 

mistwang

LiteSpeed Staff
#5
To mount a Rails application at a URL other than the document root, using /typo/ as an example, you need to define a static context /typo/ pointing to <railapp>/public/ folder, define a LSAPI context with URI /typo/dispatch.lsapi, instead of using it as a 404 handler, you have to add context level rewrite rules, you can just copy those rules in the .htaccess under public folder of that application, replace "dispatch.rb" or "dispatch.fcgi" with "dispatch.lsapi".

Also, you need to change the route configuration for the Rails application to fix the "unknow route" error if any.
 
Top