At the moment I have a PHP script set up with a chunk of code that reads a file from a dynamic location (which comes from a database) and echo's it out to the user in chunks. It's basically a file streaming script to hide the location of the original file.
However, this comes with a large overhead as PHP is clogging up my server's processes for each download. Instead I'd like to use nginx, and I'm wondering if it's possible to dynamically set the proxy_pass
directive to a value in my database.
For example, if my website has a page at http://example.com/download?hash=abcd
, I need to look up the download URL for the hash abcd
from my MySQL database and then serve that file using nginx and proxy_pass
.
Does anyone know how I can achieve this?