Nginx throws 404 when I try to serve files from a root in "location /". But if I put the same path in "location /something/", it works:
~~~~
server {
listen 8080;
server_name localhost;
location / {
root /home/username/Documents/app/static;
--------> // http://localhost:8080/something/file.js // --> Gives me 404
--------> // http://localhost:8080/file.html // --> Gives me 404
--------> // Everything is 404
}
location /something/ {
root /home/username/Documents/app/static;
--------> // http://localhost:8080/something/file.js // --> Works!!!
}
}
~~~~
I'm running a Node server within Nginx, on a different port, but I don't see how that would affect anything.
~~~~
server {
listen 8080;
server_name localhost;
location / {
root /home/username/Documents/app/static;
--------> // http://localhost:8080/something/file.js // --> Gives me 404
--------> // http://localhost:8080/file.html // --> Gives me 404
--------> // Everything is 404
}
location /something/ {
root /home/username/Documents/app/static;
--------> // http://localhost:8080/something/file.js // --> Works!!!
}
}
~~~~
I'm running a Node server within Nginx, on a different port, but I don't see how that would affect anything.