From adc25b8fca6f2296bfc466c66a0bce44f1c9b872 Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 16 Jul 2011 08:38:23 -0700 Subject: [PATCH] Created Mavenhosting service centos and cpanel (textile) --- ...osting-service---centos-and-cpanel.textile | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Mavenhosting-service---centos-and-cpanel.textile diff --git a/Mavenhosting-service---centos-and-cpanel.textile b/Mavenhosting-service---centos-and-cpanel.textile new file mode 100644 index 0000000..73cb666 --- /dev/null +++ b/Mavenhosting-service---centos-and-cpanel.textile @@ -0,0 +1,65 @@ +h1. Presentation of Mavenhosting + +Mavenhosting is based in France and Canada. They offer shared webhosting with Ruby on Rails. The Mavenhosting platform runs CentOS and it is managed through cPanel. + +h1. Installation of Tracks + +h2. Local steps + +* Step 1 : download the Tracks application and unzip it on your local computer (e.g. /home/local/tracks/...) + +* Step 2 : in /config, modify site.yml and database.yml to fit your server settings + + +h2. Prepare the migration to the shared-hosting + +h3. Step 3 : create your subdomain in the cPanel dashboard : "Domain" - "Subdomain" icon. + +In the following, we will assume your new subdomain dedicated to Tracks is : tracks.yourdomain.tld +Automatically, cPanel creates a /public_html/tracks folder on the server and tracks.yourdomain.tld originally points to this folder. + +h3. Step 4 : create the Rails application in the cPanel dashboard : "Software" - "Ruby on rails". + +Create an application named 'Tracks'. +cPanel creates a default application in /rails_apps/tracks + +h3. Step 5 : upload data to /rails_apps/tracks/ + +Delete all the content included in /rails_apps/tracks +and upload the tracks application (with the changed database.yml and site.yml files) + +h3. Step 6 : launch the Rails application + +In cPanel, go to "Software" - "Ruby on Rails", select the line corresponding to your Tracks application and press 'Start'. Refresh the page after a few seconds - if the status is now showing 'Running' it is cool. If not, something has gone wrong. + +To check it out, on the server look at /rails_apps/tracks/log/mongrel.log and /rails_apps/tracks/log/development or production.log and search errors that may explain the starting failure. If a gem is lacking, contact Mavenhosting support and ask them to install the gem. + +h3. Step 7 : the application is running... last thing to do + +For now, if you point your browser to tracks.yourdomain.tld, you don't get the application. That is normal because we did not set any redirection from the subdomain to the application. + +Go back to Software" - "Ruby on rails". Go to the "Manage Rewrites" section and 'Create a rewrite' for your Tracks application. The rewrite must say that tracks.yourdomain.tld should point to http://localhost:1200x where 1200x is the port number on which runs the Rails application. + +Once the rewrite rule created, go to /public_html/tracks/.htaccess and look at the content of the file : + +[code] +RewriteEngine on +RewriteCond %{HTTP_HOST} ^tracks.yourdomain.tld$ [OR] +RewriteCond %{HTTP_HOST} ^www.tracks.yourdomain.tld$ +RewriteRule ^/?$ "http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}" [P,QSA,L] +[/code] + +It looks good but if you go to http://tracks.yourdomain.tld, it does not work. + +Modify the .htaccess file to look like this one : + +[code] +RewriteEngine on +RewriteCond %{HTTP_HOST} ^tracks.yourdomain.tld$ [OR] +RewriteCond %{HTTP_HOST} ^www.tracks.yourdomain.tld$ +RewriteRule ^/?(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,QSA,L] +[/code] + +We have just added (.*) to catch orders sent to the controller (e.g. http://tracks.yourdomain.tld/order) and transmit this order to the Rails application with the $1 symbol. + +Now, if you go to your tracks.yourdomail.tld, it should work fine. \ No newline at end of file