How to create correct config using attached diagram?
This config cant get file from folder imagetest2 for files stored 'as is', only with rewrite rule.
server {
listen *:80;
server_name imagestest.local;
root /var/www/imagestest;
set $other_dir "/var/www/imagestest2";
location ~ / {
try_files $uri $other_dir @rewrite;
}
#try for splitted
location @rewrite {
rewrite "^/(.*)\/([0-9]{1,3})\/(.*)" "/$1/0/0/0/$2/$3" break; #1-3
root $other_dir;
error_page 404 = @fetch_image;
}
location @fetch_image {
rewrite ^(.*)$ http://somehost$request_uri permanent;
}
}
Link to diagram http://tinypic.com/r/28wgif5/8 (forum.nginx.org files seems to be not working)
This config cant get file from folder imagetest2 for files stored 'as is', only with rewrite rule.
server {
listen *:80;
server_name imagestest.local;
root /var/www/imagestest;
set $other_dir "/var/www/imagestest2";
location ~ / {
try_files $uri $other_dir @rewrite;
}
#try for splitted
location @rewrite {
rewrite "^/(.*)\/([0-9]{1,3})\/(.*)" "/$1/0/0/0/$2/$3" break; #1-3
root $other_dir;
error_page 404 = @fetch_image;
}
location @fetch_image {
rewrite ^(.*)$ http://somehost$request_uri permanent;
}
}
Link to diagram http://tinypic.com/r/28wgif5/8 (forum.nginx.org files seems to be not working)