I'm making a JavaScript web application that will reside in the directory "js" while in development. It will be concatenated into one file and placed in the "static" folder for distribution, but while I'm developing I would like the directory "/js" to point to the JavaScript source which is not located in the "static" folder.
This is my configuration file for nginx, and from what I understand it should work:
# Dev server.
server {
listen 1337;
charset UTF-8;
location /js {
root /home/tomas/projects/streamcore/js;
}
location / {
root /home/tomas/projects/streamcore/static;
index index.html;
}
}
I can access "index.html", but any request to files under "/js" ends up in 404 NOT FOUND. According to the documentation the request should match the location block with the most specific pattern, which in this case is "/js", so I don't see why this isn't working.
Please request additional information if needed. Thanks for any help.
A couple things!
I would change your file, as based on your example, to something like this: