HowTo Install Redmine in a sub-URI » History » Version 4
Michael Vance, 2009-09-18 17:51
update docs
1 | 3 | Jean-Philippe Lang | h1. HowTo Install Redmine in a sub-URI |
---|---|---|---|
2 | 1 | Jean-Baptiste Barth | |
3 | 2 | Jean-Baptiste Barth | This page explains how to run Redmine in a subdirectory of your site, for instance @http://www.mysite.com/redmine/@ ; in such a case, you can feel lost because the classic Redmine install does not work directly, and the links to css or javascript files seem to be broken. In this page, we assume you want to run Redmine under "/redmine/" subdirectory of your site. |
4 | 1 | Jean-Baptiste Barth | |
5 | 1 | Jean-Baptiste Barth | h2. Using Rails features (prefered solution) |
6 | 1 | Jean-Baptiste Barth | |
7 | 1 | Jean-Baptiste Barth | Add the following line at the end of your config/environment.rb : |
8 | 1 | Jean-Baptiste Barth | <pre> |
9 | 1 | Jean-Baptiste Barth | ActionController::AbstractRequest.relative_url_root = "/redmine" |
10 | 4 | Michael Vance | </pre>Rails will then prefix all links with "/redmine". It can be considered as the simplest, cleanest and most flexible solution. Then restart your application. In more recent versions of Rails the class hierarchy has changed slightly and you will need to use |
11 | 4 | Michael Vance | <pre> |
12 | 4 | Michael Vance | ActionController::Base.relative_url_root = "/redmine" |
13 | 4 | Michael Vance | </pre> |
14 | 4 | Michael Vance | for the class name. |
15 | 1 | Jean-Baptiste Barth | |
16 | 1 | Jean-Baptiste Barth | h2. Using Mongrel features |
17 | 1 | Jean-Baptiste Barth | |
18 | 2 | Jean-Baptiste Barth | If you run Redmine under Mongrel server, you can alternatively use the "--prefix" option of Mongrel : |
19 | 1 | Jean-Baptiste Barth | <pre> |
20 | 2 | Jean-Baptiste Barth | mongrel_rails start --prefix=/redmine |
21 | 2 | Jean-Baptiste Barth | </pre>You may not run Mongrel on port 80 : if you have an Apache server on the same host, and you run Mongrel on port 8000, you can use the following Apache config to redirect (with Apache's mod_proxy enabled) : |
22 | 1 | Jean-Baptiste Barth | <pre> |
23 | 1 | Jean-Baptiste Barth | ProxyPass /redmine http://localhost:8000/redmine |
24 | 1 | Jean-Baptiste Barth | ProxyPassReverse /redmine http://localhost:8000/redmine |
25 | 1 | Jean-Baptiste Barth | </pre> |
26 | 1 | Jean-Baptiste Barth | |
27 | 1 | Jean-Baptiste Barth | h2. Using Passenger (aka mod_rails) features |
28 | 1 | Jean-Baptiste Barth | |
29 | 2 | Jean-Baptiste Barth | If you run Redmine under Apache web server with Phusion Passenger module, you can follow "this guide":http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri ; please note it won't work correctly on some versions of Passenger or some Linux distributions. |
30 | 1 | Jean-Baptiste Barth | |
31 | 1 | Jean-Baptiste Barth | h2. With a reverse proxy |
32 | 1 | Jean-Baptiste Barth | |
33 | 1 | Jean-Baptiste Barth | If you have an Apache webserver in front of it (with mod_proxy enabled), or an Apache reverse proxy on another machine, you can run Redmine on a specific port and use this kind of config so it appears to be running in a subdirectory : |
34 | 1 | Jean-Baptiste Barth | <pre> |
35 | 1 | Jean-Baptiste Barth | ProxyPass /redmine http://real-redmine-server.localdomain:3000/ |
36 | 1 | Jean-Baptiste Barth | ProxyPassReverse /redmine http://real-redmine-server.localdomain:3000/ |
37 | 2 | Jean-Baptiste Barth | </pre>See Apache official documentation to adapt it. |
38 | 1 | Jean-Baptiste Barth | |
39 | 1 | Jean-Baptiste Barth | |
40 | 2 | Jean-Baptiste Barth | h2. Old versions of Redmine and Rails |
41 | 1 | Jean-Baptiste Barth | |
42 | 2 | Jean-Baptiste Barth | If you run a very old version of Redmine (don't know exactly which ones), maybe your version of Rails' ActionController does not support the "relative_url_root" mentionned above. Then you can look at "this page":https://www.riscosopen.org/wiki/documentation/pages/Running+Rails+applications+from+subdirectories/versions/16 to reproduce the same behaviour, but it is NOT a very good idea in most cases, you should consider upgrading Redmine. |
43 | 2 | Jean-Baptiste Barth | |
44 | 1 | Jean-Baptiste Barth | h2. References |
45 | 1 | Jean-Baptiste Barth | |
46 | 2 | Jean-Baptiste Barth | If this page did not answered your problems, you can see #2508 or "this thread":http://www.redmine.org/boards/2/topics/show/2244. |