Weblog - 1 items for cpanel
Litespeed, cpanel and Ruby on Rails web hosting
Making Litespeed, cpanel and Ruby on Rails play nicely together in providing a hosting service for many small business web hosting customers was made reasonably easy by Litespeed but still took a bit of tweeking to get right.
The desired end result is to continue using cpanel and WHM as the control panel to manage hosting accounts but to deliver the websites through Litespeed which is a faster and more efficient alternative for hosting many Ruby on Rails sites.
Note: A lot of the information here is found by mixing various info sorced by following links on the Litespeed site.
First step is to follow the instructions on http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:apache:cpanel
This takes you through installing Litespeed to first test along side Apache to be sure all the sites work ok on Litespeed and then to replace Apache. The end goal is for Litespeed to be listening on port 80 instead of Apache and to turn Apache off and disable at start up.
The next step is to setup your Ruby on Rails websites on Litespeed, good articles show you how to do this here
http://www.litespeedtech.com/ruby-lsapi-module.html
(follow the easy configuration link for details setup instructions and the use of virtual templates) and a 4 minute demo of how to set up one site here
a 4 minutes demo video by Bob Silva.
I found the easyiest and most streamlined approach was to set up a ruby on rails virtual host template. Using this template it is then easy to deliver new ruby on rails websites. (As easy as filling in 4 fields and click save).
Once I had all our hosting customers ruby on rails websites running ok it was time to address webmail and awstats urls.
Awstats
I enabled awstats in the rails virtual template so all Rails sites would have awstats.
To do this click on "Add ons" set update mode to dynamic or static the other setting as you see fit.
For authentication I created a password file realm called simple access under the security tab and then used that realm for awstats authentication.
When creating the simple_access realm I set the "User DB location" to
$VH_ROOT/config/.htpasswd
that way when I create a new site I create a password file like so for awstats authentication:
htpasswd -c rails/config/.htpasswd myauthname
Webmail
Now to set up a user firendly url to take customers to the horde webmail client at https://mywebsite.com:2096/horde/login.php
Easy enough just set redirect in the rails controller to redirect
/webmail -> :2096/horde/login.php
eg something like this:
redirect_to "https://#{request.host}:2096/horde/login.php"
Cpanel
Likewise if you want a easy to remeber url for you customers to find their cpanel control (which is at :2083 on our server)
Something like this:
redirect_to "https://#{request.host}:2083"
Hope that helps
