django app static files on the different server not get loaded

Francis Daly francis at daoine.org
Wed Jan 5 15:50:39 UTC 2022


On Mon, Jan 03, 2022 at 05:58:32PM -0500, ningja wrote:

Hi there,

> After I modified my app2 and put all my static files to static_app2 and with
> Francis' suggestion location = /static_app2/img/logo-2.jpg { proxy_pass
> https://test2.com:444; } . I was able to solve my problem.

Good stuff; thanks for sharing the result.

You probably already have this in place, but just in case not:

If all of your app2-static files are below the url prefix "/static_app2/",
you can add one location to proxy_pass them all to the test2 server, like

    location /static_app2/ { proxy_pass https://test2.com:444; }

and remove the "location =" piece that was there previously.

And if an "app3" in another container is added later, the central
nginx.conf should only need the two new locations (/app3, and
/static-app3/) for things to work as wanted too.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list