If rewrite

Igor Sysoev igor на sysoev.ru
Ср Май 26 21:17:31 MSD 2010


On Wed, May 26, 2010 at 09:47:11AM -0400, No1 wrote:

> Исправил,работает.
> http {
>     include       mime.types;
>     default_type  application/octet-stream;
>     proxy_cache_path  /var/spool/nginx/  levels=1:2   keys_zone=one:2048m;
>     proxy_cache_min_uses 1; 
> 
> 
>   server {
>         listen       80;
>         server_name  
>         access_log  /var/log/nginx/img.access.log  main;
> 
> 
> location ~* ^.(css|js)$ {
> proxy_pass   http://127.0.0.1;
> proxy_store on;
> proxy_temp_path /var/spool/nginx;
> proxy_set_header Host mydomain;
> proxy_set_header If-Modified-Since "";
> expires 1d;
> add_header Last-Modified: $date_gmt;
> add_header Cache-Control: public;
> try_files $uri $uri/;
> if (-f $request_filename) {
> break;
> }
> }
> 
> 
> location ~* ^.+small+(jpeg|jpg|png|gif)$ {
> proxy_pass   http://127.0.0.1;
> proxy_store on;
> proxy_temp_path /var/spool/nginx;
> proxy_set_header Host mydomain;
> proxy_set_header If-Modified-Since "";
> expires 1d;
> add_header Last-Modified: $date_gmt;
> add_header Cache-Control: public;
> try_files $uri $uri/;
> if (-f $request_filename) {
> break;
> }
> } 
> 
> Почему не работает кэширование статики?В /var/spool/nginx ничего нет.Не могу разобраться как должно работать кэширование файлов nginx'om.

http {
    include           mime.types;
    default_type      application/octet-stream;
    proxy_cache_path  /var/spool/nginx/cache  levels=1:2  keys_zone=ONE:2048m;
    proxy_cache_min_uses 1; 

    server {
        listen       80;
        server_name  
        access_log  /var/log/nginx/img.access.log  main;

        location ~* \.(css|js)$ {
            proxy_pass         http://127.0.0.1;
            proxy_set_header   Host mydomain;

            proxy_cache        ONE;
            proxy_cache_valid  1d;
            proxy_temp_path    /var/spool/nginx/temp;

            expires 1d;
            add_header Last-Modified: $date_gmt;
            add_header Cache-Control: public;
        }

        location ~* \.+small+(jpe?g|png|gif)$ {
            proxy_pass         http://127.0.0.1;
            proxy_set_header   Host mydomain;

            proxy_cache        ONE;
            proxy_cache_valid  1d;
            proxy_temp_path    /var/spool/nginx/temp;

            expires 1d;
            add_header Last-Modified: $date_gmt;
            add_header Cache-Control: public;
        }
    }
} 

-- 
Игорь Сысоев
http://sysoev.ru



Подробная информация о списке рассылки nginx-ru