Apache with Ruby

For this article I’m going to install a single (virtual) server to run a standard Ruby on Rails application. I will be using Apache2 and passenger for the webserver stack and MySQL as a database server.

NOTE : I got to use ruby without ruby RVM because of my ignorance(rvm will help to choose between different ruby frameworks versions).

Steps to setup Ruby App Server on Apache,Mysql to deploy a Ruby Webapp :

Let’s start by installing Ruby and all tools:
#apt-get install apache2
#apt-get install build-essential
#apt-get install ruby irb ri rdoc libopenssl-ruby ruby1.8-dev
apt-get install libcurl4-openssl-dev
apt-get install apache2-prefork-dev
#cd /usr/local/src/
#wget “http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz”

tar xvf rubygems-1.8.24.tgz

cd rubygems-1.8.24/
ruby setup.rb

ls -s /usr/bin/gem1.8 /usr/bin/gem

gem -v

gem install gemcutter

gem tumble
apt-get install mysql-server

username – root
password – PassWord

apt-get install libmysqlclient15-dev

gem install mysql

gem install rails

apt-get install git-core
gem install passenger

apt-get install libmagickwand-dev imagemagick
gem install rmagick -v ‘2.13.1’

0——- Install the MySQL database and it’s connector: ———

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql
Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17
PassengerRuby /usr/bin/ruby1.8

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific

Press ENTER to continue.
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

<VirtualHost *:80>
ServerName http://www.yourhost.com
# !!! Be sure to point DocumentRoot to ‘public’!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews

And that’s it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

/usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) 🙂
For Action Control Exception Error – during ROR Ruby App Deployment
#rake db:create db:migrate
#gem install SystemTimer


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s