Take the 2-minute tour ×

I'm furious with anyone that's ever said anything equatable to "deploying ruby on rails applications is a snap." No. It's not. It's the hardest thing I've ever had to do and I develop operating systems.

Whew. Now that that's out. I finally got passenger installed (using a bass ackwards install process) and the installer said to:

Please edit your apache configuration file and add these lines:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p290@rails-3.0.1/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290@rails-3.0.1/ruby

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 www.yourhost.com
      <Directory /somewhere/public>
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off

I put both of these in /etc/apache2/apache2.conf and when I try to start apache it says error on which ever line i put this garbage on. Help very much appreciated. I'm almost there I can feel it!


share|improve this question
you probably should include the error message in your question –  mikezter Aug 23 '11 at 11:00
for a start your virtualhosts shouldn't be in your apache2.conf - should be /etc/apache2/sites-available/railsapp refer to Ubuntu apache config guide –  Barlow Aug 23 '11 at 13:13
add comment

2 Answers

After successful installation of the Apache 2 module, follow the next set of step to configure Apache.

  1. Create the following two files in /etc/apache2/mods-available

    mkdir /etc/apache2/mods-available/passenger.load

paste following code in passenger.load file

LoadModule passenger_module /usr/lib/ruby/gems/1.9.2(your version)/gems

mkdir /etc/apache2/mods-available/passenger.conf

paste following code in passenger.conf file

PassengerRoot /usr/lib/ruby/gems/1.9.2/gems/passenger-3.0.2
PassengerRuby /usr/bin/ruby1.9.2

2. Enable the modules by creating the following symbolic links in /etc/apache2/mods-enabled

$ ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
$ ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf

3.Now create a virtual host by adding the following to 000-default file in /etc/apache2/sites-enabled.

<Directory /var/www/your_app>
         RailsBaseURI /your_app
         RailsEnv development
         AllowOverride all
         Options -MultiViews
         allow from all
  1. Now create soft link of your application, make sure you application must reside in /opt , To do you may create a separate folder for your application.

    i. $ sudo mkdir -p /opt/rails_apps

    ii. $ sudo cp -R /path/to/your_app/ /opt/rails_apps/

    iii. $ sudo ln -s /opt/rails_apps/your_app/public/ /var/www/your_app

  2. Then restart apache with the following command.

    /etc/init.d/apache2 restart

share|improve this answer
Thank you, this is useful. However after following your instructinos I can see the default index.html page from the public rails folder. The images in this page are not shown and the rest of the application is not accessible. What else should I do? –  Ariel T Jun 28 '12 at 23:40
add comment

You will get an error message when you restart Apache if you've included, verbatim, the following:

AllowOverride all              # <-- relax Apache security settings
Options -MultiViews            # <-- MultiViews must be turned off

The error it spits out is:

user@my_server:~/your_site# sudo /etc/init.d/apache restart
Syntax error on line 11 of /etc/apache2/sites-enabled/your_site:
Illegal override option #
Action 'configtest' failed.
The Apache error log may have more information.

The fix? Remove the comment lines that follow so it looks like this:

AllowOverride all
Options -MultiViews

Hope this helps!

share|improve this answer
add comment

Your Answer


