Caching questions

Igor Sysoev is at rambler-co.ru
Mon Aug 3 22:30:44 MSD 2009


On Mon, Aug 03, 2009 at 02:23:21PM -0400, shaktale wrote:

> Hi all.
> 
> I will try to start playing with cache, but is hard to find a complete documentation (yes, I know, is a new feature).
> 
> If I have a classic fastcgi with try_files like this :
> 
>   
> location / {
>      try_files $uri /index.php?$args;
>   }
> 
>   # PHP
>   location ~ ^(.+\.php.*)$ {
>     fastcgi_split_path_info         ^(.+\.php)(.*)$;
>     fastcgi_pass   127.0.0.1:9000;
> 
>     include /usr/local/nginx/conf/fastcgi_params;
>     fastcgi_param  PATH_INFO        $fastcgi_path_info;
>     fastcgi_param  SCRIPT_NAME  $fastcgi_script_name;
>   }
> 
> 
> 
> 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;
   }

   location ~ ^.+\.php.*$ {
     ...


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list