Apache Document Root change under Rails


I installed Ruby on Rails under Virtualmin GPL and everything appears to work fine except I would like now to change the Document Root directory and don't seem to find a way to do so. Specifically here is my scenario:

1) I did a clean install of virtualmin on Ubuntu 12.04 LTS server. 2) I install Rails with RVM and Phussion Passenger 3) Created a Virtual server

Rails is running fine but if for example I create a rails app by running

cd public_html
rails new app

Now the rails app root directory will be public_html/app/public so I would like for the virtual server Apache document root to point to public_html/app/public instead of public_html so the domain url access the rails application directly www.mydomain.com.tld instead of www.mydomain.com.tld/app/public. I tried using website redirects without success, perhaps I don't know how to properly specify the redirect or maybe I need to change something else. Your help would be appreciated.



Howdy -- one option is that you could use a redirect to have the client redirect from the public_html folder to the sub-directory that your application is running in.

When possible, we'd suggest not changing the DocumentRoot, and placing your files in the public_html... but if that's not possible, the other option is that you can change your DocumentRoot by going into Services -> Configure Website, click "Edit Directives", and in there you can change the DocumentRoot by editing both:

  1. The DocumentRoot directive

  2. You may need to change the path in the Directory block to match that

Then, restart Apache, and that should do the trick.

It looks like you're using Virtualmin GPL there though... don't forget that the Support area here is for Virtualmin Pro customers. For folks using Virtualmin GPL, we'd encourage you to use the forums for support. We monitor those, along with lots of wonderful folks in the community. Thanks!

Hi andreychek,

Thank you for replying, I will move the question to the Forum.