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

I have the following directory structure for my websites:


e.g /var/www/

Can I make a single generic nginx configuration to do this? So that every domain is mapped to the right directory? I would not like to edit my nginx configuration for every website I add.

The root domain can always be mapped to the www subdomain.

share|improve this question
The response you would get from the people who've used nginx the longest (in the IRC and on the mailing list) is to generate your configuration file automatically as it will work faster. – Martin Fjordvald May 6 '10 at 10:46

2 Answers 2

See this -

share|improve this answer
Thanks, this example is more accurate. – ringø Dec 18 '10 at 14:12
Please, give a small abstract here in the answer. That prevents this information from getting lost in the future. – Peter Smit Mar 16 '11 at 10:44

See here

share|improve this answer
The link you provided is dead. Could you update the link and give a small abstract here in the answer? – Peter Smit Mar 16 '11 at 10:43
It was link to my answer to another question -- it seems died along with the question. I've updated the answer with another link – Alexander Azarov Mar 23 '11 at 8:22

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.