使用nginx询问timthumb重写

时间:2015-07-30 10:50:55

标签: nginx rewrite timthumb

这是我创建的nginx.conf,

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

然而,我得到错误404 nginx,我必须做什么?感谢

1 个答案:

答案 0 :(得分:0)

好吧,我自己得到了答案

  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;
}