Redmine is a fantastic project management tool for technically oriented organizations. At my job, we use it to manage 30-50 active projects at a time, as well as the back history of several hundred projects. Oddly enough, the normal installation process puts it on port 3000 . We had some trouble with developers' ISPs not allowing HTTPS traffic over non-standard ports, so we had to move redmine onto port 443 along with the rest of the SSL traffic. We use the same hostname for several internal services, and differentiate by subdirectory - so I thought I'd just put redmine into another subdirectory.
This was more painful than I expected it to be. According to examples in the Redmine forums and many referring blog posts, you should be able to do this with a simple vhost configuration:
From my reading of this configuration, we're telling Passenger that it's application starts at /var/www/html/redmine , Rails that it should only manage URLs below /redmine , and Apache that /redmine is an alias for the public directory inside Redmine. To me, this makes sense.
But there's something a little funny about PassengerAppRoot and RailsBaseURI , because Redmine tried to serve EVERYTHING on the vhost... and of course it would get 404s for all of our other applications in subdirectories. For example, http://swearingatcomputers.blogspot.com/application would get a 404, because Rails isn't aware of /application.
So maybe this configuration works when you use Passenger for all your projects, but in a mixed environment it is not enough.
In the end, here's what worked:
{% endraw %}
This was more painful than I expected it to be. According to examples in the Redmine forums and many referring blog posts, you should be able to do this with a simple vhost configuration:
<VirtualHost *:80>
ServerName swearing.com
DocumentRoot /var/www/html
PassengerAppRoot /var/www/html/redmine
RailsBaseURI /redmine
Alias /redmine /var/www/html/redmine/public
</VirtualHost>
I'm leaving out the SSL stuff, because that's irrelevant here. The objective is to run redmine in a subdirectory, on no matter what port. :)From my reading of this configuration, we're telling Passenger that it's application starts at /var/www/html/redmine , Rails that it should only manage URLs below /redmine , and Apache that /redmine is an alias for the public directory inside Redmine. To me, this makes sense.
But there's something a little funny about PassengerAppRoot and RailsBaseURI , because Redmine tried to serve EVERYTHING on the vhost... and of course it would get 404s for all of our other applications in subdirectories. For example, http://swearingatcomputers.blogspot.com/application would get a 404, because Rails isn't aware of /application.
So maybe this configuration works when you use Passenger for all your projects, but in a mixed environment it is not enough.
In the end, here's what worked:
OK, I admit it - we cheated. Instead of using Passenger and Rails' options to set their base directory, we used Apache to do it. Sometimes the simplest solution is the best!<VirtualHost *:80>
ServerName swearing.comDocumentRoot /var/www/html
Alias /redmine /var/www/html/redmine/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/redmine>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/html/redmine/public>
PassengerEnabled on
SetHandler none
PassengerAppRoot /var/www/html/redmine
RailsBaseURI /redmine
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>