I need to make a server work this way:
Check if the requested file exists locally.
- if is there, serve it right away
- if not, pass the REQUEST_URI to a script which will download it
- if the file has ?delete=1, call the script to remove it
I had successfully implemented this behavior with nginx (using the 404 error handler) and PHP. The thing is that to implement this on another server I have to install/compile both nginx and php.
My question is if there is a way to remove php from the stack and put up nginx (or some other server) to do the job. An ideal way for me would be if I could run/call bash scripts/commands directly from the server.
Does anyone can point me to the right direction?