NGINX: dynamic locations stored in DB

configurationdynamicnginxvideo-hosting

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.

Best Answer

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.