jwilder/nginx-proxy: serving static files for multiple apps - how to separate static files dir for different apps

233 Views Asked by At

I followed this question serving static files from jwilder/nginx-proxy to serve static files.

This works fine with one app with static files. I want to add a second app, which means I need to have a root directory for static files per app. Otherwise, there is the risk of name collisions. Is there a way to specify the static files folder per app?

Maybe subfolders per app in the root directory would work as well, but there are apps where I cannot influence where they store their static files. So I don't see how this could work.

1

There are 1 best solutions below

0
On

to handle static files with multiple directories you can use this method

location /static/ {
  expires 30d;
  access_log off;
  try_files tmp/static/$uri tmp/static/$uri/ tmp/static2/$uri tmp/static2/$uri/;
}