Project

General

Profile

Redmine on sub-uri with nginx

Added by Benedikt V. about 9 years ago

I've just seen, it landed in the wrong place. One might move this to the support forum.


Hey,
First: I found many posts on this but either they don't help me or they are over 2 Years old and point to some bug (which I think should til now be fixed).

I try to setup redmine on a sub-uri (simply /redmine).
I followed the HowTo and it doesn't work at all(404 of redmine for everything)
So I added some line I found somewhere in the webs so that my environment.rb look like this now:

# 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

#Force production env
ENV['RAILS_ENV'] ||= 'production'

RedmineApp::Application.routes.default_scope = "/redmine" #Line I found in the webs

# Initialize the rails application
RedmineApp::Application.initialize!

#Redmine::Utils::relative_url_root = "/redmine" #Line from the HowTo

With this addition the main page loads, but without any other (css,themes,etc.). The HowTo line doesn't have any influence anymore, so nothing changes if its commented or not.

And here is my nginx server config:

server {
    listen [::]:443 ssl;
    server_name <hostname>;
    root /srv/http/webapps/;
    index index.php;

    location ~ ^/redmine(/.*|$) {
#        root /srv/http/webapps/redmine/public;
#        alias /srv/http/webapps/redmine/public$1;
#        passenger_base_uri /redmine;
#        passenger_app_root /srv/http/webapps/redmine;
#        passenger_document_root /srv/http/webapps/redmine/public;
#        passenger_enabled on;
        proxy_pass http://unix:/srv/http/webapps/redmine/tmp/sockets/passenger.socket;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host $host;
    }
#---some ssl settings cut out---
}

The commented lines are from the phusion manual for nginx as linked in the HowTo (the link is old, but redirects to the new one.. might be changed in wiki).
Again uncommenting them doesn't change anything.
As you can see, redmine is running as a reverseproxy with the command:
passenger start --socket=/srv/http/webapps/redmine/tmp/sockets/passenger.socket -d

In general (location / {...}) it works if not on the sub-uri .
Also I tried with out regex (location /redmine {...}). But this throws 404 of nginx of the extra files (css,themes,etc.).

Greetings, X4fyr

-------------------------------------------------------------------------
Environment:
Redmine version 2.6.1.stable
Ruby version 2.0.0-p598 (2014-11-13) [armv7l-linux-eabihf]
Rails version 3.2.21
Environment production
Database adapter Mysql2
SCM:
Git 2.3.0
Filesystem
Redmine plugins:
no plugin installed

production.log (10.1 KB) production.log just starting passenger and opening the main page