Re: Caching differences in Production and Development modes?

Ezra Zygmuntowicz
Wed, 02 Nov 2005 05:35:55 -0000

On Nov 1, 2005, at 5:40 PM, Darron Froese wrote:

> I''m trying to get my app to the state where I can launch it and
> noticing some strangeness with rails 0.14.2 and caching.
>
> The long and the short of it is: Caching seems to work like it should
> in development mode on webrick (with caching turned on in
> config/environments/development.rb) but seems to rewrite the page
> every time in production mode using lighttpd.
>
> Development Environment: OSX, webrick, mysql 5.0.13
> Production Environment: Linux RHEL 3, MySQL 4.0.24, lighttpd:
>
> server.modules =
("mod_rewrite","mod_redirect","mod_fastcgi")
> server.document-root = "/var/httpd/virtual-hosts/ncache/current/
> public"
> fastcgi.server =  (".fcgi" => ( "ncache" =>
>   ( "min-procs" => 1,
>     "max-procs" => 5,
>     "socket" => "/tmp/ruby-ncache.fcgi",
>     "bin-environment" => ( "RAILS_ENV" =>
"production" ),
>     "bin-path" =>
"/var/httpd/virtual-hosts/ncache/current/public/
> dispatch.fcgi"
>   )
> ))
> server.indexfiles = ( "dispatch.fcgi", "index.html" )
> server.error-handler-404 = "/dispatch.fcgi"
> server.errorlog = "/var/httpd/virtual-hosts/ncache/current/log/
> lighttpd.log"
>
>

Darron-
	You need the following line that tels lighty to look first on the
file system for the action name with .html tacked on the end. Whats
going on for you is that caching is working fine but lighty is just
hitting rails everytime and generating a new .html file. Add this
line above your fastcgi.server block:

url.rewrite = ( "^/$" => "index.html",
"^([^.]+)$" => "$1.html" )

	That will take care of it for you.

Cheers-

-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org
509-577-7732