Redmine Installation / Ruby on Rails and FCGI

Added by Klaus Friese almost 3 years ago

Hi,

I made a new installation of redmine on a managed server, I don't have root access. Redmine installation seemed to work, I now have problem with the integration in the Apache with FCGI.

This is what I see in the documentation of my provider:
https://wiki.hetzner.de/index.php/Installation_g%C3%A4ngiger_Software_(Managed_Server)/en#Ruby_over_FCGI

ruby_handler.fcgi

#!/bin/dash
export GEM_HOME="$HOME/.gem/ruby/2.3.0/" 
export GEM_PATH="$GEM_HOME:/var/lib/ruby/gems/1.8" 
exec /usr/bin/ruby /usr/www/users/<FTP-USER>/<PROJECT-DIRECTORY>/index.rb

.htaccess

FcgidWrapper /usr/www/users/<FTP-USER>/ruby_handler.fcgi .rb
  SetHandler fcgid-script

Problem: I don't have a index.rb in redmine, the dispatcher in the redmine documentation is completely different. And at the moment I get an 404 error when I try the dispatcher and htaccess from the wiki (http://www.redmine.org/projects/redmine/wiki/Install_Redmine_34_on_RHEL74)

How can I get redmine working on my system?

Thanks for any tipps
Klaus

Replies (3)

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Jens Kabisch 2 months ago

Hello Mr. Friese,

I am having the same problems right now. Did you get redmine working at Hetzner?

regards
Jens

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Klaus Friese 2 months ago

Hi,

Finally our solution was switching to a dedicated server with full root access. We didn't manage to get redmine running on a managed server, too many restrictions.

Regards
Klaus

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Jens Kabisch 2 months ago

Good news. We got redmine (4.2.6) finally working on the managed server with fastcgi. The problem was that the RAILS_ENV was not set to production. So we have to edit/create two files in the public folder:

.htaccess:

Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly." 

And the dispatch.fcgi:

#!/usr/bin/env ruby

ENV['RAILS_ENV'] = 'production'

require File.dirname(__FILE__) + '/../config/boot'
require File.dirname(__FILE__) + '/../config/environment'

class Rack::PathInfoRewriter
  def initialize(app)
    @app = app
  end

  def call(env)
    env.delete('SCRIPT_NAME')
    parts = env['REQUEST_URI'].split('?')
    env['PATH_INFO'] = parts[0]
    env['QUERY_STRING'] = parts[1].to_s
    @app.call(env)
  end
end

Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(RedmineApp::Application)

regards
Jens

(1-3/3)