proxy_cache ramdisk

Igor Sysoev igor at sysoev.ru
Mon Feb 1 19:38:01 MSK 2010


On Sun, Jan 31, 2010 at 04:26:05PM -0600, AMP Admin wrote:

> I'm able to cache php pages with the following but I can't seem to cache
> static images with proxy_cache.
> 
> 
> This works:
> 
>         location ~ \.php$ {
>
>                         fastcgi_index index.php;
>                         fastcgi_pass 127.0.0.1:9000;
>                         fastcgi_cache cachephp;
>                         fastcgi_cache_key 127.0.0.1:9000$request_uri;
>                         fastcgi_cache_valid 200  1h;
>                         include fastcgi_params;
>                         fastcgi_intercept_errors On;
>                         fastcgi_ignore_client_abort On;

"On" are invalid parameters.

>                         fastcgi_buffer_size 128k;
>                         fastcgi_buffers 4 128k;
>          }
> 
>  
> 
> This does not work:
> 
>         location ~* \.(jpg|jpeg|gif|css|png|js|ico|tif)$ {
>                         access_log off;
>                         expires 30d;
>                         proxy_pass http://127.0.0.1;
>                         proxy_cache_key $scheme$host$request_uri
>                         proxy_cache cachestatic;
>                         proxy_cache_valid 200  1h;
>                         proxy_cache_valid 404  5m;

Why do you want to cache image from localhost ?
You should handle them as static files.

>                         break;
>         }

"break" is useless here. It's just waste of CPU cycles.


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



More information about the nginx mailing list