In this example,
<domainname> = burnside.kattare.com
<document_root> = ~/burnside_kattare_com
<appname> = burnside_on_rails
<controller> = Hello
<username> = burnside
<action> = hello
cd ~<username>
Use the rails command to setup the application base.
rails <appname>
Link the application base into your document root.
ln -s ../<appname>/public <document_root>/<appname>
vi/pico <appname>/public/.htaccess
change dispatch.cgi to dispatch.fcgi, this will speed things up significantly.
vi/pico <appname>/public/dispatch.fcgi
Change dispatch.fcgi to use gems by changing
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
to
require 'rubygems'
gem 'fcgi'
require 'fcgi'
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
Generate a controller.
cd <appname>
./script/generate controller Hello
vi/pico app/controllers/hello_controller.rb
class HelloController < ApplicationController
def hello
end
end
Setup a view:
vi/pico app/views/hello/hello.rhtml
<html>
<head>
<title>Hello Rails World</title>
</head>
<body>
<h1>Hello from Rails on Kattare!</h1>
<p>The current time is <%= Time.now %></p>
</body>
</html>
Test!
http://burnside.kattare.com/burnside_on_rails/Hello/hello
(http://<yourdomain>/<appname>/<controller>/<action>)
Looks good!