RedMine over Passenger -- Access to public
Added by Paul Bilokon over 14 years ago
Hi all,
I have set up RedMine over Passenger on Apache.
Here is my Apache configuration:
<VirtualHost *> ServerName www.thalesians.com DocumentRoot /www/html/www.thalesians.com <Location /projects> RailsEnv production RailsBaseURI /projects PassengerAppRoot /www/html/www.thalesians.com/projects </Location> <Directory /www/html/www.thalesians.com/projects/public> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
RedMine is physically installed under /www/html/www.thalesians.com/projects.
Now my problem is that all the links generated by RedMine are like this : "/projects/stylesheets/foo.css", "/projects/images/bar.png", whereas they should be "/projects/stylesheets/public/foo.css", "/projects/images/public/bar.png".
Therefore the stylesheets and images don't get displayed.
Changing
/www/html/www.thalesians.com/projects/config/additional_environment.rb
so that
config.action_controller.relative_url_root = "/projects"
becomes
config.action_controller.relative_url_root = "/projects/public"
introduces other problems (then it expects everything to be under /projects/public). Is there a way to fix this problem without copying the contents of /projects/public to /projects?
Many thanks,
Paul
Replies (2)
RE: RedMine over Passenger -- Access to public - Added by Felix Schäfer over 14 years ago
Please read the passenger documentation (http://www.modrails.com), the public
directory of a rails app is supposed to be served under the URL you expect the app to be under, not under THE_APP_URL/public
. Make sure to read and understand the documentation, but off the top of my head, something like that should work:
<VirtualHost *> ServerName www.thalesians.com DocumentRoot /www/html/www.thalesians.com <Directory /www/html/www.thalesians.com/projects> Options None AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
RE: RedMine over Passenger -- Access to public - Added by Felix Schäfer over 14 years ago
Felix Schäfer wrote:
[...]
Argh too quick, next try:
<VirtualHost *> ServerName www.thalesians.com DocumentRoot /www/html/www.thalesians.com Alias /projects /www/html/www.thalesians.com/projects/public <Directory /www/html/www.thalesians.com/projects/public> Options None AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
The preferred solution though would be to leave your redmine installation out of your DocumentRoot, say in /www/app/www.thalesians.com/redmine
, and to link /www/html/www.thalesians.com/projects
to /www/app/www.thalesians.com/redmine/public
. Passenger should recognize that http://www.thalesians.com/projects
is a "link" to the public directory of a rails app and will serve it accordingly. In that case, go with:
<VirtualHost *> ServerName www.thalesians.com DocumentRoot /www/html/www.thalesians.com <Directory /www/html/www.thalesians.com/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <Directory /www/html/www.thalesians.com/projects> Options None AllowOverride None </Directory> </VirtualHost>
(again, all off the top of my head, DO read the documentation an make sure to UNDERSTAND it!)