Zr40
Zr40

Reputation: 1919

Redmine doesn't work properly in Apache

I'm trying to get Redmine (a Ruby on Rails app) working. It works fine when started with ruby script/server webrick -e production, however, I'm having trouble getting it working in Apache with Passenger.

Accessing http://example.com/redmine returns the Redmine home page, but clicking any link (or even adding a / to the URL) results in a 404. According to the Rails log, a RoutingError occurs. For example, when opening the projects page: ActionController::RoutingError (No route matches "/projects.html" with {:method=>:get})

The Redmine directory is /var/www/localhost/htapps/redmine. I followed the documentation at http://www.modrails.org/documentation/Users%20guide.html#_deploying_a_ruby_on_rails_application (section 3.2), so there's a symlink at /var/www/localhost/htdocs/redmine pointing to ../htapps/redmine/public, and the Apache configuration contains DocumentRoot /var/www/localhost/htdocs and RailsBaseURI /redmine.

What is causing it to raise these RoutingErrors?

Upvotes: 3

Views: 7944

Answers (4)

iDen
iDen

Reputation: 75

Even if you will manage to run Redmine in suburi, redmine still will have issues. Some pages won't be parsed and displayed correctly, if displayed at all.

This issue is almost one year old and indicated for next minor release. Btw dozen minor releases came out, but it's not yet fixed. FCGI mode does not support sub-URI.

Upvotes: 0

PAT
PAT

Reputation: 507

If not deploying to a Sub-URI and deploying using passenger, adding the rule RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] to your public/.htaccess also solves the issue. As that rule is IfModule-ed out in the default .htaccess.

Another option is to delete .htaccess if you're not using it (As an example you may be using it for additional layer authentication with AuthType Digest etc). It is not required when deploying with passenger.

Upvotes: 0

Zr40
Zr40

Reputation: 1919

It looks like this issue was actually caused by the default .htaccess included with Redmine.

Redmine's .htaccess rewrites every request to end with .html. Redmine's routes expect .html-less requests.

Setting RewriteEngine to Off solved the issue for me.

Upvotes: 2

Corban Brook
Corban Brook

Reputation: 21378

http://ptspts.blogspot.com/2009/05/how-to-fix-railsbaseuri-sub-uri-with.html

The manual workaround (according to what is suggested on the pages above) is adding the line below to config/environments/production.rb:

config.action_controller.relative_url_root = '/redmine'

Upvotes: 0

Related Questions