-
-
Notifications
You must be signed in to change notification settings - Fork 537
Mavenhosting service centos and cpanel
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.
- 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
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.
Create an application named ‘Tracks’.
cPanel creates a default application in /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)
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.
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.