如果您仍然希望使用反向代理来使用 Mongrel + Apache,这里是我在我们的系统(Win2k3、Apache 2.2、Redmine 的主干)上解决相同问题的方法。秘诀是安装您的杂种服务,使用--prefix /redmine
它告诉它从http://localhost:port/redmine
在 Apache httpd.conf(或合适的包含文件)中:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
<IfModule mod_proxy.c>
ProxyRequests Off
#No need to forward on static content - let apache do it faster
ProxyPass /redmine/images !
ProxyPass /redmine/stylesheets !
ProxyPass /redmine/javascript !
# Remove the following entry on public sites as this is insecure
ProxyPass /redmine/plugin_assets !
ProxyPass /redmine/help !
ProxyPass /redmine http://localhost:4000/redmine
ProxyPassReverse /redmine http://localhost:4000/redmine
ProxyPreserveHost On
#continue with other static files that should be served by apache
Alias /redmine/images C:/Repositories/redmine/public/images/
Alias /redmine/stylesheets C:/Repositories/redmine/public/stylesheets/
Alias /redmine/javascript C:/Repositories/redmine/public/javascript/
# Remove the following on public sites as this is insecure
Alias /redmine/plugin_assets C:/Repositories/redmine/public/plugin_assets/
Alias /redmine/help C:/Repositories/redmine/public/help/
</IfModule>
# Make sure apache can see public and all subfolders - not suitable for public sites
<Directory "C:/Repositories/redmine/public/">
Allow from all
Order allow,deny
</Directory>
Mongrel 是这样安装的:
mongrel_rails service::install --prefix /redmine -N redmine_prod -p 4000 -e production -c C:\Repositories\redmine
希望对某人有所帮助。最初,我尝试设置 Apache + fastcgi 等,但我失去了更多宝贵的头发——它不适合 Windows。
Ps 我发现这个 PDF 是一个非常有用的参考:http: //www.napcsweb.com/howto/rails/deployment/RailsWithApacheAndMongrel.pdf
/达米安