Q:

Nginx location setting

nginx.conf
...
location ~ ^/file/ {
    root /ProjectData/b2b;
    add_header Access-Control-Allow-Origin *;  
}

file organization
ProjectData
  b2b
    img
      a.png  

url: http://localhost:8008/file/img/a.png
How to set nginx.conf to make my url work without change my file organization?

A:

Change root to alias and it worked.
location /file {
    alias /ProjectData/b2b;
    add_header Access-Control-Allow-Origin *;  
}

