Ruby Rails under Virtualmin GPL

Hi,

After much goggling on how to install Rails stack under Virtualmin I came across a great script that pretty much sets up everything for you: https://www.digitalocean.com/community/articles/how-to-install-rails-apache-and-mysql-on-ubuntu-with-passenger except for one seemingly elusive detail: setting up the root document directory for the rails application in Virtualmin.

In essence, after running this great script a Rails Stack is install and one can create a new rails app and the app will run under Apache Phussion Passenger.:Lets say that after running the script I move to the public_html directory and create the skeleton of a Rails App:

cd public_html
rails new MyApp

This will create a new directory name MyApp and under it the following directory structure:

app
config
config.ru
db
doc
Gemfile
Gemfile.lock
lib
log
public
Rakefile
README.rdoc
script
test
tmp
vendor

Now, say the Virtual Server Domain Name was “mydomian.tld”, the default root directory will be “public_html” but the rails application document root needs to be “public_html/MyApp/public” so that when the browser is pointed to “mydomain.tld” the rails app is ran instead of having to type: “http://mydomain.tld/MyApp/public”.

I have played around with setting a domain alias but I can’t get it to work (obviously I don’t know how to set it up). Any advise on accomplishing that when a browser is pointed to mydomain.tld it renders the files from “public_html/MyApp/public” instead of the files from “public_html” will be appreciated.

I think the domain alias should do the trick but I keep getting a redirect looping error when I try to set it up. Also tried setting up a subserver domain alias but I don’t think this is the route to follow for what I want to do.

Thanks again for any help.

PS: I don’t want to make a change to all virtual servers, just to one in particular where I am running rails.

Ok, I found the problem. For those interested the solutions is: Go to “Virtualmin - Server Configuration - Website Redirects” then create “Add new website redirect” and enter the following:

Source URL path: /
Destination (Directory on this system): /home/home_directory/public_html/MyApp/public/

My problem was leaving the trailing “/” in the Destination URL.

Hope this helps others.