When I try to cache with nginx I get 404 on resources

Stan asked:

I googled around and found some scripts on how to cache static resources on nginx, the problem is that when I apply these scripts I get 404 on my scripts and styles. What am I doing wrong here?

I’m sorry but I don’t know how to copy from nano using putty so I made a picture of how my config looks like. Note that I commented caching section. If I uncomment it my static files will be 404.

enter image description here

My answer:

You forgot to place a root directive in your server block to specify where your static files are.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.