Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

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.

share|improve this answer
+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
Thank you, this seems to be the best solution. – chimpanzee Aug 31 '10 at 15:14

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.