nginx rewrite phpphumb & cache-control

I want to use phpthumb generator & add some custom expires header to all images

When I use only phpthumb rewrites it working but when add cache-control rewrites can't generate new thumbs

my code is:

#thumb generation
location /cache/ {
   if (-f $request_filename) {
    break;
   }
   rewrite ^/cache/(.*)$ /cache/index.php?thumb=$1 permanent;
}

and for cache-control:

location ~* .(ico|css|js|gif|jpe?g|png)$ {
  expires 7d;
  access_log off;
  add_header Pragma public;
  add_header Cache-Control "public";
}

I try also this with no luck ..

#for phpthumb
location /cache/ {
   try_files $uri @missing;
}

location @missing {
  rewrite ^/cache/(.*)$ /cache/index.php?thumb=$1 permanent;
}

location ~* .(ico|css|js|gif|jpe?g|png)$ {
 expires 7d;
 access_log off;
 add_header Pragma public;
 add_header Cache-Control "public";
}

Any ideas how to solve this? Спасибо, T.

0
задан 30 July 2018 в 16:37
1 ответ

No enger Nuecht drop, hunn ech e richtege Wee fonnt:)

location ~* \.(?:jpe?g|png)$ {
  expires 7d;
  access_log off;
  add_header Pragma public;
  add_header Cache-Control "public";

  try_files $uri $uri/ @thumbs;
}

location @thumbs {  
  rewrite ^/cache/(.*)$ /cache/index.php?thumb=$1 permanent;
}

Mäi grousse Problem dee falsch Ëmschreiwe produzéiert war op nginx. conf:

# cache informations about FDs, frequently accessed files
# can boost performance, but you need to test those values
#open_file_cache max=200000 inactive=20s;
#open_file_cache_valid 30s;
#open_file_cache_min_uses 2;
#open_file_cache_errors on;

Nodeems ech kommentéiert hunn, funktionnéieren dës Zeilen nei schreiwen korrekt.

0
ответ дан 5 December 2019 в 05:28

Теги

Похожие вопросы