Thursday, January 27, 2011

NGINX: dynamic locations stored in DB

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.

  • 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.

    vmfarms : +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.
    chimpanzee : Thank you, this seems to be the best solution.
    From Joris
  • nginx has a plugin, that accepts Perl , in the config files. You could use that to query a db.

    From polemon

0 comments:

Post a Comment