In this post I am going to show how to make apache the server for all ruby on rails application on local machine.
In the previous post I had shown how to install apache web server ad configure it.
My software stack:
- Ubuntu 11.04
- ruby 1.9.2 p290.
- Rails 3.1.10
- rubygems 1.8.10
Lets start!
I assume that you have a rails app in the following path:
/home/username/Desktop/rails_apps/my_rails_app
It is important to note that apache serves all local request via www directory in /var.
/var/www
So the first step is to create a symbolic link:
ln -s /home/username/Desktop/rails_apps/my_rails_app/public /var/www/my_rails_app
Note that sym link should be to your appls publc folder.
Now edit the following file(you can coly paste the code)
sudo gedit /etc/apache2/sites-available/default
In this file, append the follwing line:
RailsBaseURI /my_rails_app RailsEnv development #(if you want to run on development mode default is production)
Restart apache using
sudo /etc/init.d/apache2 restart
Now on you browser when you type 127.0.1.1/my_rails_app the app should fire up ! Hurray you have done it !
————————————–warning for ruby 1.9.2p290————————————————
When I fired up my app, I got an error
Can’t convert nil to hash,
This is phsyc problem and to solve this, add the following to boot.rb
(this issue existed when I did used it )
require ‘yaml’
YAML::ENGINE.yamler = ‘syck’