The web project have static content into the some /content/img folder. The url rule is: /img/{some md5} but location in the folder: /content/img/{The first two digits}/
Example
url: example.com/img/fe5afe0482195afff9390692a6cc23e1
location: /www/myproject/content/img/fe/fe5afe0482195afff9390692a6cc23e1
This nginx location is correct but lot not security (the symbol point is not good in regexp):
location ~ /img/(..)(.+)$ {
alias $project_home/content/img/$1/$1$2;
add_header Content-Type image/jpg;
}
The next location is more correct, but not work:
location ~ /img/([0-9a-f]\{2\})([0-9a-f]+)$ {
alias $project_home/content/img/$1/$1$2;
add_header Content-Type image/jpg;
}
Help me find error for more correct nginx location.