1

I've installed mod_passenger for Apache on my Linux box. The module has compiled correctly and Apache seems to be loading it correctly (no errors with this side of things).

BUt when I set up a vhost to point to a Rails app (Redmine project management), I get a page moaning about "Ruby on Rails application could not be started". Specifically, "Error message: No such file or directory - config/environment.rb".

I can see that there is indeed a config/environment.rb in the Redmine root folder. My vhost config is like this:

<VirtualHost *:80>
# server DocumentRoot, address, and admin email

RailsBaseURI /redmine
DocumentRoot /srv/www/htdocs

</VirtualHost>

I have got the Redmine source at /srv/www/htdocs/redmine (with no symlinks or anything because it was moaning about that).

In a fit of rage because nothing was working, I recursively set the file ownership and mode of the /redmine folder to wwwrun:www (my Apache user and group) and 777. Do you think this is the problem?

Any ideas or advice greatly appreciated.

PS. Are there any projects out there to rewrite Redmine in PHP? LOL!

2 Answers 2

1

I got the same error, and this http://randomthoughtsgr.wordpress.com/2011/10/17/redmine-sub-uri-and-apache-configuration/ helped me to resolve it!

While trying to setup Redmine in a sub-uri I run across an issue will trying to setup apache. Passenger would display the following error: No such file or directory – config/environment.rb while trying to access the Redmine webpage.

After trying a few suggestions on the issue I managed to get Redmine to work with the following configuration:

The passenger.load configuration file was the following (the paths will probably vary depending on the installation):

LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9
PassengerRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby
PassengerDefaultUser www-data

In the Virtual Host configuration I added the following:

PassengerAppRoot /usr/local/lib/redmine-1.2/
RailsBaseURI /redmine
RailsEnv production

PassengerAppRoot represents the path that redmine is installed.
RailsBasedURI represents the sub directory in the URL that represents Redmine eg. http://www.example.org/redmine

(for this to work is also essential to have a symbolic link of the redmine-./public inside the web root folder).

Also I changed ownership of the redmine-1.2 folder and the symlink redmine folder to the apache user/group (I am under the impression that it was necessary).

0

The deployment mode for sub-URI deployments of passenger is rather specific.

You have to create symlinks. These have to point to the public directory (not the RAILS_ROOT). Passenger uses the information from this symlink to find the rest of the application. This is to make sure that you never install your Rails app inside the document root (which you should never ever do to avoid having your code and configuration openly visible to anyone.)

In your case that would mean to install Redmine to something like /srv/www/redmine. Then create a symlink

ln -s /srv/www/redmine/public /srv/www/htdocs/redmine

With that in place, you can keep your virtual host as is, assuming your webserver user has the right to read all files inside /srv/www/redmine/public. As a final tip: check the owner of the config/environment.rb file. It's owner is going to be the user redmine is run at (as long it's not root).

For more information have a look at the excellent Passenger documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .