Project

General

Profile

How to configure Redmine 2.5.1 to run as sub-URI

Added by Alessandro Guerra over 9 years ago

Hi all, I'm quite new to Redmine (and httpd/Ruby/Rails etc :-P)... My current goal is to run it as sub-URI but actually I didn't find any solution that work for me or at least I'm not able to get them works. I've tried several configurations (found here and around the web) but all have failed... To be honest I'm not able to give you furhter details about configuration I have tested so far because I didn't tracked them... I hope you can guide me through the correct configuration. Thanks in advance.

Environment Information

CentOS 6.5 / Apache 2.2.15 / Phusion Passenger 4.0.45 / Ruby 1.9.3p547 / Rails 3.2.17 / MySQL 5.1.73

RAILS_ENV=production script/about

sh: svn: command not found
sh: darcs: command not found
sh: hg: command not found
sh: cvs: command not found
sh: bzr: command not found
sh: git: command not found
Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p547 (2014-05-14) [x86_64-linux]
  Rails version                  3.2.17
  Environment                    production
  Database adapter               Mysql2
SCM:
  Filesystem                     
Redmine plugins:
  no plugin installed


Replies (7)

RE: How to configure Redmine 2.5.1 to run as sub-URI - Added by Jan Niggemann (redmine.org team member) over 9 years ago

How did you install passenger, did you use a package (yum?) or the passenger gem?
What exactly is the issue you're facing?

RE: How to configure Redmine 2.5.1 to run as sub-URI - Added by Alessandro Guerra over 9 years ago

I had different results with different conf... I would try to reproduce errors I got and post here.

With this conf I can see the sub-Uri correctly but only the list of files instead of formatted site.


<VirtualHost *:80>
    ServerName servername.domain.int
    DocumentRoot /var/www/html
    <Directory /redmine/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>

    # These have been added:
    Alias /redmine /var/www/html/redmine/public
    <Location /redmine>
        PassengerBaseURI /redmine
        PassengerAppRoot /redmine/public
    </Location>
    <Directory /var/www/html/redmine/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>
</VirtualHost>

RE: How to configure Redmine 2.5.1 to run as sub-URI - Added by Jan Niggemann (redmine.org team member) over 9 years ago

Did you enable the passenger module in apache?
I've not used RedHat / Centos in years, but grep -Ri passenger /etc/apache2/* and check.
Do you have the files passenger.conf and and passenger.load?
If so, please post the contents of both.

RE: How to configure Redmine 2.5.1 to run as sub-URI - Added by Alessandro Guerra over 9 years ago

Here is Passenger.conf

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so
 <IfModule mod_passenger.c>
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45
   PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby
</IfModule>

Attached the result of the command issued.

I did another test, here is the content of redmine.conf

<VirtualHost *:80>
    ServerName servername.domain.int
    DocumentRoot /var/www/html
    <Directory "/var/www/html/redmine/public/">
    Options Indexes ExecCGI FollowSymLinks
        Allow from all
    Order allow,deny
    AllowOverride all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>

    # These have been added:
    Alias /redmine /var/www/html/redmine/public
    <Location /redmine>
        PassengerBaseURI /redmine
        PassengerAppRoot /redmine/public
    </Location>
</VirtualHost>

and the environment.rb

# Load the rails application

require File.expand_path('../application', __FILE__)

# Make sure there's no plugin in vendor/plugin before starting

vendor_plugins_dir = File.join(Rails.root, "vendor", "plugins")

if Dir.glob(File.join(vendor_plugins_dir, "*")).any?

  $stderr.puts "Plugins in vendor/plugins (#{vendor_plugins_dir}) are no longer allowed. " +

    "Please, put your Redmine plugins in the `plugins` directory at the root of your " +

    "Redmine directory (#{File.join(Rails.root, "plugins")})" 

  exit 1

end

# Initialize the rails application

RedmineApp::Application.initialize!
Redmine::Utils::relative_url_root = "/redmine" 
#ActionController::AbstractRequest.relative_url_root = "/redmine" 
#ActionController::Base.relative_url_root = "/redmine" 

and .htaccess

# General Apache options
<IfModule mod_fastcgi.c>
        AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
        AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /redmine /var/www/html/redmine/public
#   RewriteBase /redmine

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
<IfModule mod_fastcgi.c>
        RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_fcgid.c>
        RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

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

The result is now "Rails application failed to start properly"

RE: How to configure Redmine 2.5.1 to run as sub-URI - Added by Alessandro Guerra over 9 years ago

Now it is working.

During my tests I have also edited the file additional_environment.rb... Just mv the file and everything seems ok now.

    (1-7/7)