Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Weird 404, only when serving static on “location /”

$
0
0
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.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>