page caching using public/cache directory

91 visualizações
Pular para a primeira mensagem não lida

backbonedesign

não lida,
5 de jun. de 2008, 17:38:0405/06/2008
para Phusion Passenger Discussions
I would like to move my cached pages to public/cache/ so I can easily
delete all of my pages when I make a change to my application.

See: http://www.railsenvy.com/2007/2/28/rails-caching-tutorial#moving

But since Passenger doesn't use the .htaccess file, Apache is unable
to see the cached pages.

Any ideas how I can get this to work?


Hongli Lai

não lida,
5 de jun. de 2008, 17:46:4705/06/2008
para phusion-...@googlegroups.com

You can enable .htaccess support by setting RailsAllowModRewrite to On.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

backbonedesign

não lida,
5 de jun. de 2008, 21:04:0205/06/2008
para Phusion Passenger Discussions
What are the consequences in Passenger with RailsAllowModRewrite
enabled?

Can you please elaborate on "rewrite rules to negate its effects" in
the below sentence in the docs?
"But please note that you will have to delete Rails applications'
default .htaccess file, or add rewrite rules to negate its effects."

On Jun 5, 3:46 pm, Hongli Lai <hon...@phusion.nl> wrote:
> backbonedesign wrote:
> > I would like to move my cached pages to public/cache/ so I can easily
> > delete all of my pages when I make a change to my application.
>
> > See:http://www.railsenvy.com/2007/2/28/rails-caching-tutorial#moving
>
> > But since Passenger doesn't use the .htaccess file, Apache is unable
> > to see the cached pages.
>
> > Any ideas how I can get this to work?
>
> You can enable .htaccess support by setting RailsAllowModRewrite to On.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl

Hongli Lai

não lida,
6 de jun. de 2008, 15:20:4006/06/2008
para phusion-...@googlegroups.com
backbonedesign wrote:
> What are the consequences in Passenger with RailsAllowModRewrite
> enabled?
>
> Can you please elaborate on "rewrite rules to negate its effects" in
> the below sentence in the docs?
> "But please note that you will have to delete Rails applications'
> default .htaccess file, or add rewrite rules to negate its effects."

The default Rails .htaccess forwards all requests to
dispatcher.cgi/dispatcher.fcgi, thereby bypassing Passenger unless
RailsAllowModRewrite is on. Make sure that requests are not forwarded to
dispatcher.cgi/dispatcher.fcgi, and you'll be fine.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl

Matt Scilipoti

não lida,
11 de jun. de 2008, 17:35:0411/06/2008
para Phusion Passenger Discussions
I was able to use public/cache on passenger 1.9.0 by adding this to my
vhost conf file:

RewriteEngine On
RewriteRule ^([^.]+)$ /cache/$1.html [QSA]

Note: the leading slash was needed on suse/apache (it is not included
in many 'helpful' blogs).
Note: I did NOT need to use: RailsAllowModRewrite on. It didn't seem
to make a difference. I did not do any performance comparisons.

I tried these entries in the .htaccess file, but they were not
recognized/utilized. I attempted this with & w/o
RailsAllowModRewrite.

I hope this helps,
Matt Scilipoti

On Jun 6, 3:20 pm, Hongli Lai <hon...@phusion.nl> wrote:
> backbonedesign wrote:
> > What are the consequences in Passenger with RailsAllowModRewrite
> > enabled?
>
> > Can you please elaborate on "rewriterules to negate its effects" in
> > the below sentence in the docs?
> > "But please note that you will have to delete Rails applications'
> > default .htaccess file, or addrewriterules to negate its effects."
>
> The default Rails .htaccess forwards all requests to
> dispatcher.cgi/dispatcher.fcgi, thereby bypassing Passenger unless
> RailsAllowModRewrite is on. Make sure that requests are not forwarded to
> dispatcher.cgi/dispatcher.fcgi, and you'll be fine.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl

Matt Scilipoti

não lida,
11 de jun. de 2008, 18:03:1211/06/2008
para Phusion Passenger Discussions
Just to be clear...
When the above mentioned rewrite entries didn't work in .htaccess
(those were the only entries), I deleted the .htaccess file.

Here is my conf:
<VirtualHost *:80>
ServerName myapp.example.com
DocumentRoot /path/to/myapp/current/public


<Directory /path/to/myapp/current/public>
Order Deny,Allow
Allow from all
</Directory>

## tell passenger to allow apache rewrite rules (seems to be
optional as of 06/11/08)
RailsAllowModRewrite on

RewriteEngine On
## Uncomment for rewrite debugging
#RewriteLog /path/to/myapp/current/log/rewrite_log
#RewriteLogLevel 9

#apache should serve cached pages
RewriteRule ^([^.]+)$ /cache/$1.html [QSA]

#*************************
# SVN
# this not only blocks access to .svn directories, but makes it
appear
# as though they aren't even there, not just that they are forbidden
<DirectoryMatch "^/.*/\.svn/">
ErrorDocument 403 /404.html
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>

</VirtualHost>

--Matt Scilipoti

Tom Copeland

não lida,
13 de jun. de 2008, 21:59:3013/06/2008
para phusion-...@googlegroups.com

On Wed, 2008-06-11 at 15:03 -0700, Matt Scilipoti wrote:
> # SVN
> # this not only blocks access to .svn directories, but makes it
> appear
> # as though they aren't even there, not just that they are forbidden

FWIW, if you're using Capistrano, you can use this:

set :copy_strategy, :export

to use "svn export" vs "svn checkout". That way you won't have to
supply a directive to handle them...

Yours,

tom


backbonedesign

não lida,
19 de jun. de 2008, 15:37:3719/06/2008
para Phusion Passenger Discussions
Thanks Matt. Unfortunately I only have access to the .htaccess file
(please prove me wrong) since it is being hosted on a shared server at
dreamhost.
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem