0

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.

  • Why not create different docker containers for each App which serves the static files? Then you would have everything standard (make use of standard images). Nginx forwards static-file-requests for each App to its specific Container (pointed to by IP or domain in Nginx Proxyserver) – BertC Apr 12 '22 at 08:10

1 Answers1

0

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/;
}
Mojtaba Ahadi
  • 316
  • 1
  • 4