[Mongrel] Apache rewrites with mongrel

Ralf Vitasek neongrau at gmail.com
Mon Jun 16 06:06:08 EDT 2008


why do you need rewrites at all?

just point your document root to the rails public dir
and these ProxyPass settings should be enough

   ProxyPass /images !
   ProxyPass /stylesheets !
   ProxyPass /javascripts !
   ProxyPass / balancer://mongrelcluster/
   ProxyPassReverse / balancer://mongrelcluster/



--  
Freundliche Grüße,
Ralf Vitasek


o
L_
OL

This is Schäuble.
Copy Schäuble into your signature
to help him on his way to Überwachungsstaat




Am 16.06.2008 um 11:47 schrieb Guido Holz:

>
> I´m knew to rewrites on apache in combination with mongrelcluster.
> It´s urgend for me, because the server has an loadaverage about 10
> :-(((((
>
> Ok so I´m using 3 mongrel-server on an mongrelcluster. The  
> Loadbalancer
> ist apache
> I think, that my rewrites are not correct. Please can anybody check my
> rewrites ?
>
>
> That´s in my /etc/apache2/conf.d/rails.proxy_cluster.conf
> <Proxy balancer://mongrel_cluster>
>  BalancerMember http://127.0.0.1:4712
>  BalancerMember http://127.0.0.1:4713
>  BalancerMember http://127.0.0.1:4714
> </Proxy>
>
> that´s in my /etc/apache2/sites-enabled/000-rails
>
>        RewriteEngine On
>
>        # Deflate
>        AddOutputFilterByType DEFLATE text/html text/plain text/css
> text/xml
>        BrowserMatch ^Mozilla/4 gzip-only-text/html
>        BrowserMatch ^Mozilla/4.0[678] no-gzip
>        BrowserMatch bMSIE !no-gzip !gzip-only-text/html
>
>        ProxyPass /images !
>        ProxyPass /stylesheets !
>        ProxyPass /javascripts !
>
>        Alias /images /var/www/rails/myApp/current/public/images
>        Alias /stylesheets
> /var/www/rails/myApp/current/public/stylesheets
>        Alias /javascripts
> /var/www/rails/myApp/current/public/javascripts
>
>        RewriteLog /var/log/apache2/rails-rewrite.log
>
>
> And last not lease my .htaccess in public
>
> AddHandler fastcgi-script .fcgi
> AddHandler cgi-script .cgi
> Options +FollowSymLinks +ExecCGI
>
> AddDefaultCharset UTF-8
> RewriteEngine On
>
> RewriteRule ^01,([0-9]*).html$ balancer://mongrel_cluster/shop/event/ 
> $1
> [P,QSA,L]
> RewriteRule ^01,([a-zA-Z0-9]*),([0-9]+).html$
> balancer://mongrel_cluster/shop/search/$2?startnumber=$1 [P,L]
>
> RewriteRule ^$ index.html [QSA]
> RewriteRule ^([^.]+)$ $1.html [QSA]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
>
>
> the rewrite for static-sites is correct?
> I saw this lines on a howto
>
> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
>
>
> if I call www.myApp.com/shop (redirected internaly by globalize to
> en/shop )
> then I`ll get the cached page under public/en/shop.html
>
> but when I call www.myApp.com/shop again then I can see in my logfiles
>
> Processing ShopController#index (for xx.xxx.xxx.xx at 2008-06-16
> 11:46:04) [GET]
>  Session ID: 4cbe53c829bdc7ef9ceb81cc6f0fe1fa
>  Parameters: {"action"=>"index", "controller"=>"shop", "locale"=>"en"}
> Rendering template within layouts/shop
> Rendering shop/index
> Completed in 0.17766 (5 reqs/sec) | Rendering: 0.09954 (56%) | DB:
> 0.00000 (0%) | 200 OK [http://www.myApp.com/en/shop/]
>
> I think something went wrong with my rewrites.
>
>
> thanks for helping.
>
> cheers guido
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list