title: How to use Nginx Regexp in the location
body: <p>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}/ </p>
  
  <p>Example </p>
  
  <pre><code>url:      example.com/img/fe5afe0482195afff9390692a6cc23e1
  location: /www/myproject/content/img/fe/fe5afe0482195afff9390692a6cc23e1
  </code></pre>
  
  <p>This nginx location is correct but lot not security (the symbol point is not good in regexp):</p>
  
  <pre><code>        location ~ /img/(..)(.+)$ {
                 alias $project_home/content/img/$1/$1$2;
                 add_header Content-Type image/jpg;
           }
  </code></pre>
  
  <p>The next location is more correct, but not work:</p>
  
  <pre><code>        location ~ /img/([0-9a-f]\{2\})([0-9a-f]+)$ {
                 alias $project_home/content/img/$1/$1$2;
                 add_header Content-Type image/jpg;
           }
  </code></pre>
  
  <p>Help me find error for more correct nginx location.</p>