Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Moving now from apache to nginx, also rewriting .htaccess to nginx. I have such "problem":

I have about ten sites, that utilize same core.
So I have a bunch of rewrite rules that should go to each of one of them. Moreover, number of sites will be added, as well as number of common rules.

In apache i've used to write all common directives to global /www folder when all websites are placed.

But for now, in nginx i cant determine how should i organize config file.

I have about 10 common rules and 30 per-site rules for every site.

So have no idea, how to NOT to write 10 common rules to each config and in the same time to provide each site with his own rules.

Thanks in advance.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can create a new file in /etc/nginx containing your shared directives, and then include them in each site's configuration.

The config files which ship with nginx include an example of this: fastcgi_params contains shared directives that are used in various configuration files where they call include fastcgi_params;.

share|improve this answer
    
Thanks This is simple.. By the way, do you know how nginx handles includes? I mean, if there are lot of includes this mean that in memory stored lots of duplicates or I have nothing to worry about? –  Tigra Jul 17 '12 at 9:43

Your Answer

 
discard

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.