Ruby on Rails with Apache2
Continuing on from our last post Redmine Project Management on Debian Lenny, here we will setup Ruby on Rails (and thus Redmine) to run through Apache2, using Passenger (aka mod_rails).
This is a fairly brief step by step guide and assumes you are familiar with Debian, the command line, and tools like apt-get and ruby gems.
- Install passenger:
sudo gem install passenger - Setup passenger in Apache. Run this command and follow the instructions:
sudo passenger-install-apache2-module - When it asks you to edit the Apache config file, do it like so (using the contents given to you by the program):
Create /etc/apache2/mods-available/passenger.load with the contents:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/ext/apache2/mod_passenger.soCreate /etc/apache2/mods-available/passenger.conf with the contents:
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14
PassengerRuby /usr/bin/ruby1.8Enable passenger module:
a2enmod passengerNote: Make sure you use the values provided by the program and do not simply copy & paste what is here!
- Edit the Virtual host file to something like this:
<VirtualHost *>
ServerName redmine.mydomain.com
DocumentRoot /var/redmine/1.0-stable/public
RailsEnv production
</VirtualHost>Note: The document root cannot be a softlink, because the dispatch script of rails will change directory using “../”
- Restart Apache and all should be good:
sudo /etc/init.d/apache2 restart - Test by going to http://redmine.mydomain.com