After deploying Ubuntu 8.10 server, installing Ruby on Rails and all its prerequisites, and installing Phusion Passenger, there are just a few Passenger specific steps necessary to get your Rails application up and running.
Create a directory to house all of your Rails applications (you can put this wherever you like):
cd mkdir railsapps cd railsapps
Create your Rails application (“first”) with a mysql database:
rails -d mysql first
Create a SymLink for Passenger to follow from your application/public directory to the Apache DocumentRoot/SubUri:
sudo ln -s ~/railsapps/first/public /var/www/first
Update the Apache config to let Passenger know about the application:
sudo vi /etc/apache2/sites-enabled/000-default
Append the following at the end of the config:
Restart Apache to apply your changes:
sudo /etc/init.d/apache2 restart
Now that we have Apache and Passenger looking in the right places, we can get back to editing some of the Rails settings.
Change into our rails application root directory:
Edit the /railsapps/first/config/environment.rb file to notify rails that you are operating out of a SubURI
Just inside the end of the function “Rails::Initializer.run do |config|” add the following:
config.action_controller.relative_url_root = "/first"
So the last few lines of your environment.rb file should look like:
# Activate observers that should always be running # Please note that observers generated using script/generate observer need to have an _observer suffix # config.active_record.observers = :cacher, :garbage_collector, :forum_observer config.action_controller.relative_url_root = "/first" end
Edit the /railsapps/first/config/database.yml file to make sure you have correctly specified your database login information
Call rake to create your application database
Your first rails app is now up and running! You should be able to browse to it at http://YourServerURI/first