在URL子目录中安装Redmine的Apache配置



我在为我安装的Redmine配置apache时遇到了一个问题。

我已经成功地在/usr/local/lib/目录中安装了Redmine (v 1.2.1)并且它可以工作。我想配置apache,以便Redmine可以通过http://myhost/redmine访问,而我已经在/var/www中安装了一个绑定到http://myhost/的基于wordpress的网站。我该怎么办?

这是我当前的apache配置(/etc/apache2/sites-enabled/001-redmine):

<VirtualHost *:80>
        ServerName myhost
        DocumentRoot /usr/local/lib/redmine-1.2.1/public
        ServerSignature off
        <Directory />
                Order Deny,Allow
                Deny from all
        </Directory>
        <Directory /usr/local/lib/redmine-1.2.1/public>
                AllowOverride None
                Order allow,deny
                Allow from all
                Options Indexes ExecCGI FollowSymLinks
                Options -MultiViews
        </Directory>
        ErrorLog /var/log/apache2/redmine-error.log
        CustomLog /var/log/apache2/redmine-access.log combined
</VirtualHost>

谢谢。

您也可以访问Redmine网站的FAQ: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI

我使用了Phusion Passenger作为Ruby插件。然后我把公共文件夹符号链接到/var/www/redmine。

我的Apache配置有:

RailsBaseURI /redmine
<Directory /var/www/redmine>
   Options -MultiViews
</Directory>

我之前也遇到过同样的问题,并做了一些笔记。根据我当时的想法,将Redmine Mongrel隐藏在myhost/Redmine目录后面是不完全可能的。正确,Apache可以通过以下方式设置它作为网关:

ProxyPass /redmine/ http://myhost:4000/
ProxyPassReverse /redmine http://myhost:4000
ProxyPreserveHost on

但是这只会在由Redmine返回的HTML包含相对路径而不是单个绝对路径的情况下工作。假设一个Redmine页面/dir1/whatever.html引用了一个CSS文件/resources/styles.css。客户端看到的HTML页面是/redmine/dir1/whatever.html。如果CSS引用是相对的,客户端请求/redmine/CSS/styles.css, Apache将把它转发给代理作为/CSS/styles.css。但是,如果引用是绝对的,客户机请求/css/styles.css, Apache将不会作为该引用的代理。故事到此结束

注:有一个第三方模块mod_proxy_html解析HTML和重写引用。但是它不会出现在大多数服务器上。

解决方案似乎是将/redmine目录中的任何请求显式重定向到http://myhost:4000的Mongrel(应该可以使用mod_rewrite)。

最新更新