I have files at /Users/me/myproject
and I want to serve them at http://stuff.dev/something
using a simple nginx config. In the /Users/me/myproject
folder is something like:
index.html
scripts/
app.js
styles/
style.css
So I really want to be able to access http://stuff.dev/something
, http://stuff.dev/something/scripts/app.js
etc.
In my nginx conf I have this:
server {
listen 80;
server_name stuff.dev;
location /something {
index index.html;
root /Users/me/myproject;
}
}
This doesn't work (I get a 404 if I try to go to those above URLs), however if I try the exact same set up but using location / {
instead of location /something {
, it works fine. How can I serve this directory of files statically but at a path instead of at the location root? Do I have to have the files in a folder called "something" like /Users/me/myproject/something
for this to work? If so is there a way around that?