Having read a bunch of other topics similar to this one, I'm still not sure what would be best.
Let's say I have a load balancer with 2 servers which have Nginx + Django, and then a separate database server and 3 storage servers with images and videos.
How do I best serve the media files from the 3 storage servers ? What I currently plan to do is keeping my 2 entry points for all the requests. A request for a media file would be authenticated there by Django and then I would use X-accel direct to proxy pass the media request to the storage servers. However, the Nginx docs state this:
When NGINX proxies a request, it sends the request to a specified proxied server, fetches the response, and sends it back to the client.
Does this mean that the load would be the same for the 2 entry point servers ? This is how I would understand it, which is not very efficient.
What I would like to achieve is something like this:
The request is authenticated by Django, the redirected towards the storage server which sends the response directly to the client. Is this possible?
I guess the most efficient way performance wise to serve media files would be to remove the app server step, like so:
However, this would mean that I cannot authenticate the media request with Django and have to use secure links, which is the secure link module for Nginx. How good is the security with those links?