HowTo Install Redmine in a sub-URI » History » Version 1
Jean-Baptiste Barth, 2009-02-27 10:41
Initial version
1 | 1 | Jean-Baptiste Barth | h1. HowTo Install Redmine in a subdirectory |
---|---|---|---|
2 | |||
3 | This page explains what to do if you want to run Redmine in a subdirectory of your site, for instance @http://www.mysite.com/redmine/@ ; in such a case, many people 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 | |||
5 | h2. Using Rails features (prefered solution) |
||
6 | |||
7 | Add the following line at the end of your config/environment.rb : |
||
8 | <pre> |
||
9 | ActionController::AbstractRequest.relative_url_root = "/redmine" |
||
10 | </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. If it works for you, you don't have to read the rest of this page. |
||
11 | |||
12 | h2. Using Mongrel features |
||
13 | |||
14 | If first config failed, and you run Redmine under Mongrel app server, you can start it with "--prefix" option : |
||
15 | <pre> |
||
16 | mongrel_rails --prefix=/redmine |
||
17 | </pre>You may not run Mongrel on port 80 ; then 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) : |
||
18 | <pre> |
||
19 | ProxyPass /redmine http://localhost:8000/redmine |
||
20 | ProxyPassReverse /redmine http://localhost:8000/redmine |
||
21 | </pre> |
||
22 | |||
23 | h2. Using Passenger (aka mod_rails) features |
||
24 | |||
25 | If first config failed, and 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. |
||
26 | |||
27 | h2. With a reverse proxy |
||
28 | |||
29 | 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 : |
||
30 | <pre> |
||
31 | ProxyPass /redmine http://real-redmine-server.localdomain:3000/ |
||
32 | ProxyPassReverse /redmine http://real-redmine-server.localdomain:3000/ |
||
33 | </pre>This config has to be adapted ; see Apache official documentation to understand how it works. |
||
34 | |||
35 | h2. Old versions of Rails |
||
36 | |||
37 | 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 you have to note it is NOT a very good idea in most cases ; consider upgrading Redmine in order to run recent versions of Rails (>= 2.1 may support the directive mentionned above). |
||
38 | |||
39 | h2. References |
||
40 | |||
41 | If this page did not answered your problems, you can see these threads or issues : #2508 and "this thread":http://www.redmine.org/boards/2/topics/show/2244. |