mod_rewrite multiple rails apps

Discussion in 'Install/Configuration' started by totalnet, Jun 22, 2007.

  1. totalnet

    totalnet Member

    Just got litespeed working with rails virtual host template. Now I want set the virtual host to mod_rewrite for multiple rails apps.

    For example, I type, I want litespeed run the rails app at /var/www/rails/app1, at /var/www/rails/app5, and etc.

    For apache, I had this mod_rewrite setup.

    RewriteCond %{HTTP_HOST} [^.]+\.example\.com$
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
    RewriteRule ([^.]+)\.example\.com(.*) /var/www/rails/$1$2

    So on my litespeed config for rails virtual host, I have turn on rewrite and put in those 3 lines in the rewrite rules. I have also setup the wildcard on the hostname as *

    So what am I missing that will get this working?

  2. mistwang

    mistwang LiteSpeed Staff

    No need to use rewrite, just create a vhost for each application, and bind to the listener on the respective domain name.
    You can use our Rails template to make your life easier.

    This kind of mass hosting with rewrite rule is not available for Rails. Since each application will take a lot of resource, it is recommended to combind those apps if you could.
  3. totalnet

    totalnet Member

    That's the thing, I don't know what those rails apps will be called. I am giving my rails programmers ssh access to /var/www/rails. They create create/gem install those apps, edit database.yml, and etc. I want litespeed automatically serve out those rails app by the hostname from URL.

Share This Page