Let me describe what I am trying to do first.
I have a bunch of pictures in a directory called /images/*.(jpg|gif|png|blah blah|)
Now say these images are embedded in an html page and I dont really care which image or where its embedded.
For every 10th request for the same picture file (if possible) or for any picture I want to display a fixed image (e.g. trollface.jpg). thats it!
I have searched around a bit but i am not even sure what I am looking for. Rewrite might help but then its a permanent thing. this has got to do something with requests. I have heard perl scripts can be used with nginx. I can't write an nginx module (though I did bravely lookup the docs and then gave up)
Before you ask "But why don't you do it in application, noob?". This is a static files only server. The point is to not execute any binary at all.