Hi ! I''m no expect when it comes time to configure Apache. I just enabled page caching in my Rails app, and am now looking at making Apache serve the cached files instead of calling into Rails. I know Mongrel is able to serve cached files if it finds them, but I''d like Apache to do it. Looking at .htaccess, there is this section: RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] The last line MUST change because I am proxying. What should it change to is what I''m wondering. I tried: RewriteRule ^(.*)$ balancer://smrty/ [QSA,L] but that simply generates an HTML file that says "Found, document moved here", with here being a link to "balancer://smrty/". Anybody knows what I should be using here ? Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/
On 7/20/06, Francois Beausoleil <francois.beausoleil at gmail.com> wrote:> I''m no expect when it comes time to configure Apache. I just enabled > page caching in my Rails app, and am now looking at making Apache > serve the cached files instead of calling into Rails. > > I know Mongrel is able to serve cached files if it finds them, but I''d > like Apache to do it. > > Looking at .htaccess, there is this section: > > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > The last line MUST change because I am proxying. What should it > change to is what I''m wondering. I tried: > > RewriteRule ^(.*)$ balancer://smrty/ [QSA,L] > > but that simply generates an HTML file that says "Found, document > moved here", with here being a link to "balancer://smrty/". > > Anybody knows what I should be using here ?Try this: RewriteRule ^/(.*)$ balancer://smrty%{REQUEST_URI} [P,QSA,L] -- Coda Hale http://blog.codahale.com
Hi ! 2006/7/20, Coda Hale <coda.hale at gmail.com>:> RewriteRule ^/(.*)$ balancer://smrty%{REQUEST_URI} [P,QSA,L]Tried it and it didn''t work. I also tried keeping only these: RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] But that returned a 403 Forbidden instead. Thanks Coda ! -- Fran?ois Beausoleil http://blog.teksol.info/
On 7/20/06, Francois Beausoleil <francois.beausoleil at gmail.com> wrote:> 2006/7/20, Coda Hale <coda.hale at gmail.com>: > > RewriteRule ^/(.*)$ balancer://smrty%{REQUEST_URI} [P,QSA,L] > > Tried it and it didn''t work. I also tried keeping only these: > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > > But that returned a 403 Forbidden instead.Huh. Well, you may want to check your config files against mine: http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/ -- Coda Hale http://blog.codahale.com
Francois, This works for me: RewriteEngine On RewriteRule ^/$ /index.html [QSA] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://cruster%{REQUEST_URI} [P,QSA,L] Tested with curl for content and httperf for performance. Matt On Jul 20, 2006, at 4:11 PM, Francois Beausoleil wrote:> Hi ! > > 2006/7/20, Coda Hale <coda.hale at gmail.com>: >> RewriteRule ^/(.*)$ balancer://smrty%{REQUEST_URI} [P,QSA,L] > > Tried it and it didn''t work. I also tried keeping only these: > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > > But that returned a 403 Forbidden instead. > > Thanks Coda ! > -- > Fran?ois Beausoleil > http://blog.teksol.info/ > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
2006/7/20, Matt Pelletier <matt at eastmedia.com>:> RewriteEngine On > RewriteRule ^/$ /index.html [QSA] > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://cruster%{REQUEST_URI} [P,QSA,L]Works for me too. Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/