Returns a random file at a specific URL

Is it possible to configure nginx to a specific url with each request given a random single static file from a given set?
October 8th 19 at 00:14
5 answers
October 8th 19 at 00:16
Watched, yeah. But in the repository without this nginx module is assembled.
May be using mod_rewrite? - Elroy.Wyman commented on October 8th 19 at 00:19
What prevents to rebuild? Get the recipe from the same repository and build on it. - Ignatius.Fadel34 commented on October 8th 19 at 00:22
October 8th 19 at 00:18
And 'crutches' kind of do not want?
<?php header('Location: '.rand(1000000,9999999)); ?>
Indeed, in this case files and clients will remain static, with all the caching, etc.

I checked the browsers without problems open all the resources needed, regardless of how many redirects were made to obtain them.
October 8th 19 at 00:20
It is better to recompile nginx for themselves, it's easy. When they solved this problem through random_index, and then finished in the module set_misc function set_random var min max; where to give a random file URL is much more convenient. By the way this is used to rotate the pre-stored static html blocks.
Now I think to change the rotation policy (because of the 5 blocks randomly often podrjada the same shows). Did the team set_rotate var from to; and sent a pull request to the developer of the module set_misc. Using this command makes an internal rotation of the units order, the value of the last block shown can be saved in Cookies
October 8th 19 at 00:22
If ngnix assembled with wiki.nginx.org/EmbeddedPerlModule it is possible for them.
The script is not difficult, if not obtained by means of nginx, and I will do) - Elroy.Wyman commented on October 8th 19 at 00:25
October 8th 19 at 00:24
A simple script in PHP or anything else, giving X-Accel-Redirect (http://wiki.nginx.org/XSendfile)

Find more questions by tags NginxProcessing URL