Asking about timthumb rewrite using nginx

351 Views Asked by At

Here my nginx.conf that i create,

location / {
try_files $uri $uri/ /index.php?q=$request_uri&$args;
rewrite ^thumb/([^/]+)x([^/]+)/(.*) timthumb.php?src=http://$3&h=$2&w=$1 last;
}

However, i got error 404 nginx, what i must do? thanks

1

There are 1 best solutions below

0
Abdul Ajis On

well, i got my answer by myself

  location ~* \.(js|css|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|wml|swf|pdf|doc|docx|ppt|pptx|zip)$ {
   expires max;
   log_not_found off;
   add_header Pragma public;
   add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location / {
rewrite ^/thumb/([0-9]+)x([0-9]+)_(.*) /timthumb.php?src=http://$3&h=$2&w=$1 last;
try_files $uri $uri/ /index.php?q=$request_uri&$args;
}