2

Is there a possibility to store nginx locations in DB instead of the config to serve them dynamically?

The task is to create dynamic URLs for video files based on user's IP and video ID.

The idea is when the user visits my website such an dynamic URL is created and added to the db as a new nginx location that exists just for this user and not for others.

Or nginx doesn't fit my task and I need to use another tool?

Thanks.

chimpanzee
  • 121
  • 1
  • 2

2 Answers2

4

I'd delegate this to a backend language (like php, for example) and use the X-Accel-Redirect header from there.

Your backend can talk to databases or filesystems all it wants; actual spoonfeeding of the clients is delegated back to nginx - a pretty good setup.

Joris
  • 5,939
  • 1
  • 15
  • 13
  • +1 - this is what I would do. nginx is meant to be a simple, fast web server. Having it do more complex things is something a backend is suited for. – vmfarms Aug 30 '10 at 18:43
2

nginx has a plugin, that accepts Perl , in the config files. You could use that to query a db.

polemon
  • 565
  • 2
  • 8
  • 21