On 10/05/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > So, Paul, do you have Apache do the asset (CSS,JS,image) serving? I'm > trying your recipe, and the rails app works fine, but I get 404 errors for > the assets. > > Here's my setup: > > httpd.conf > > <Proxy balancer://cyapm> > BalancerMember http://127.0.0.1:8100 > BalancerMember http://127.0.0.1:8101 > BalancerMember http://127.0.0.1:8102 > BalancerMember http://127.0.0.1:8103 > BalancerMember http://127.0.0.1:8104 > </Proxy> > > RewriteEngine On > # Punt any pontential 404s to the proxy > RewriteCond %{REQUEST_FILENAME} ^/timesheets/.* > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > # for HTTPS > #RequestHeader set X_FORWARDED_PROTO 'https' > RewriteRule ^/(.*)$ balancer://cyapm/$1 [proxy] > > And in /var/www/rails/cyapm/current/config/environments.rb (appended at the > end): > > ActionController::AbstractRequest.relative_url_root = "/timesheets" > > If I connect directly to a mongrel, say http://ciwebdev:8100/, the Rails > app lives at /timesheets, but the assets live in /stylesheets, > /javascripts, /images. The links Rails generates now expects them to be in > /timesheets/stylesheets, /timesheets/javascripts, /timesheets/images. > > Do you have any Rewrite magic for that?
What I failed to mention is that for the setup we have here instead of having /public/ be the document root we instead have /rails/ be a symlink to the app's /public/ directory, thus the normal javascript files live in /rails/javascript/ for us and the generated URLs are right. We've got this setup so that rails stuff lives in it's own directory without touching any of the other parts of the web root. For an example of doing this without having the subdirectory issue check out this set of instructions - it's what I started out with and then butchered into the above config: http://blog.innerewut.de/articles/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel Paul. _______________________________________________ Mongrel-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-users
