Caching questions
Igor Sysoev
is at rambler-co.ru
Tue Aug 4 10:45:23 MSD 2009
On Tue, Aug 04, 2009 at 02:34:20AM -0400, shaktale wrote:
> > The url http://mydomain.com/statics/.* is handled by index.php, but really is a simple static page.
> >
> > Is there any manner to caching only these URLs ?
> >
> > location ~ ^/statics/.+\.php.*$ {
> > fastcgi_split_path_info ^(.+\.php)(.*)$;
> > fastcgi_pass 127.0.0.1:9000;
> >
> > fastcgi_cache FCGI;
> > fastcgi_cache_key 127.0.0.1:9000$request_uri;
> >
> > include /usr/local/nginx/conf/fastcgi_params;
> > fastcgi_param PATH_INFO $fastcgi_path_info;
> > fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> > }
>
> Sorry, I explained myself bad:
>
> I need to redirect everything to index.php (I did it with try_files):
>
> http://www.mydomain.com/ => index.php
> http://www.mydomain.com/foo => index.php?foo
> http://www.mydomain.com/statics/page1 => index.php?page1
>
> But, I ONLY want to cache URLs like /statics/.+ after it has been processed by index.php
>
> Is there possible ?
location /statics/ {
try_files $uri @statics;
}
location @statics {
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache FCGI;
fastcgi_cache_key 127.0.0.1:9000$request_uri;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_NAME /path/to/index.php;
fastcgi_param QUERY_STRING $uri;
}
The only problem is that /statics/page1 will be passed as
/index.php?/statics/page1, but not to /index.php?page1
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list