Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have followed http://linux.mickgenie.com/how-to-install-redmine-with-cpanel/ to install redmine on my cpanel box. Got it up and running fine except that it doesn't load any static files (js, css, png). Upon investigation i found that it actually gives 404 error when trying to load those files. My Setup Is like:

  • Nginx: 80
  • Apache: 8081, 443
  • Mogrel/Ruby: 12001

.htaccess contains:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^projects.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.projects.domain.com$
RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L]

permissions in ~/rails_apps/projects/

755 - dirs
644 - files
share|improve this question
add comment

2 Answers

By default, Rails doesn't deliver the static files because they're usually provided directly by the web server. In your configuration with URL rewrite, Apache can't deliver the files because it doesn't know anything about them.

You can make Rails deliver static files by setting config.serve_static_assets to true in your environment file (probably config/environments/production.rb). You must restart the Mongrel server for this to take effect.

Alternatively and preferably, you may configure Apache (or nginx) to serve these files. On any request http://hostname/path, if the corresponding redmine_root/public/path file exists, it should be delivered. Otherwise, the request should be forwarded to the Mongrel.

share|improve this answer
    
For .htacess tried: pastebin.com/xcGES2td , neither version worked. and for that config.serve_static_assets, when start mongel i got: pastebin.com/HrqxXgpz . Googled for the error, found that people did went through this but no one posted a solution. –  Shoaibi May 7 '11 at 4:33
    
Ah, redmine uses Rails 2.3 which seems to always deliver static assets. So that's not the problem. I'll try another answer. –  Michaël Witrant May 8 '11 at 13:23
    
Are the asset URLs wrong (ie, they contain 127.0.0.1)? Can you provide the error log of Apache and nginx when you access these assets? –  Michaël Witrant May 8 '11 at 13:39
    
Nope, asset urls are fine, and nothing special going in apache error logs. –  Shoaibi May 10 '11 at 16:49
add comment

chmod 644 /var/www/you cPanel dir

It should work out for you. Cheers

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.