Location and document path in nginx -


this nginx configuration file:

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;     } 

}

and directory of document this:

d:/workspace/javascript/maplib     -- v1.0          --main.js     -- v1.1 

now want access v1.0/main.js http://localhost/js/api/v1.0/main.js.

and return 404 error.

it seems ngnix tried file through d:/workspace/javascript/maplib/js/api/v1.0/main.js not exist.

it seems string path in locaation(in url) must exist @ file system.

how fix meet requirement?

btw, there not js other kinds of files .gif,.png,.html inside d:/workspace/javascript/maplib/.

use alias. ref: http://nginx.org/en/docs/http/ngx_http_core_module.html#alias

that is, replace

root   d:/workspace/javascript/maplib/; 

by

alias   d:/workspace/javascript/maplib/; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -