Shared nginx configuration for multiple servers

Antoine Bonavita antoine.bonavita at
Wed Apr 6 19:57:15 MSD 2011


I'm no expert but from what I can see in the code (ngx_conf_file.c),
the argument to include directive is not "evaluated". So, I would say
the behavior you are seeing is "as expected" although probably not the
one you would like...
May be you can confirm by enabling debug on your install. In the logs
you should see a line like "include <filename>".

Good luck.


On Wed, Apr 6, 2011 at 1:00 AM, Ondrej Jombik <jombik at> wrote:
> We have bunch of servers, where we want to share configuration via SVN
> or GIT (or whatever). So on all server there will be the same
> configuration files set - this is easy to maintain.
> Although the most of the configuration is the same on all servers, there
> is a small set of differences for certain servers.
> I would like to separate this per-server configuration differences into
> files called $hostname.conf in the conf.d directory.
> However this is not working for me:
>    include /etc/nginx/conf.d/$hostname.conf;
> Is this supposed to work, or not? If not, what is prefered way to
> achieve my goal?
> Thanks
> Ondrej
> --
> Ondrej JOMBIK
> Platon Technologies Ltd., Hlavna 3, Sala SK-92701
> +421 903 PLATON - info at -
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list