title: Location and document path in nginx
body: <p>This is my nginx configuration file:</p>
  
  <pre><code>server {
      listen       80;
      server_name  localhost;
  
      location / {
          root   d:/www;
          index  index.html index.htm;
      }
      location /js/api/ {
          root   D:/workspace/javascript/maplib/;
          autoindex on;
      }
  }
  </code></pre>
  
  <p>And the directory of the document is like this:</p>
  
  <pre><code>D:/workspace/javascript/maplib
      -- v1.0
           --main.js
      -- v1.1
  </code></pre>
  
  <p>Now I want to access the <code>v1.0/main.js</code> by <code>http://localhost/js/api/v1.0/main.js</code>.</p>
  
  <p>And it returns a 404 error.</p>
  
  <p>It seems that ngnix will tried to get the file through <code>D:/workspace/javascript/maplib/js/api/v1.0/main.js</code> which does not exist.</p>
  
  <p>It seems that the string path in the <code>location</code>(in the url) must exist at the file system.</p>
  
  <p>How to fix it to meet my requirement?</p>
  
  <p>BTW, there is not only the js but also some other kinds of files like <code>.gif,.png,.html</code> inside the  <code>D:/workspace/javascript/maplib/</code>.</p>