I need to serve my app through my app server at 8080, and my static files from a directory without touching the app server. The nginx config I have is something
In your case, you can use root directive, because $uri part of the location directive is the same with last root directive part.
Nginx documentation advices it as well:
When location matches the last part of the directive’s value:location /images/ { alias /data/w3/images/; }it is better to use the root directive instead:
location /images/ { root /data/w3; }
and root directive will append $uri to the path.