Variables in access_log

miradev nginx-forum at
Tue Jul 7 13:53:02 MSD 2009

batrick Wrote:
> I have run into a similar problem. I wanted to set
> up a number of virtual hosts that each share the
> same configuration except, of course, for the
> domain name and path. So my plan was to set some
> environment variables, and then include the
> template configuration file.

My particular set up is not for 'live' sites (in the typical manner), and I would support Merlin's suggestion to build config files for each one. I do infact do exactly that. A simple template with some variables replaced, and you are away. You never know when you need to add just that one custom setting for that client. For the dev sites, I would just build a completely new site if something specific was wanted, but to unravel a live site from such a fixed structure might be troublesome.

> Unfortunately, the plan faltered somewhat because
> error_log and server_name do not seem to support
> variables.
> Does anybody know of a documentation which
> directives support variables and which do not?

I'm guessing with the pace at which nginx is moving, that if you want such a list, you will have to head to the wiki and compile it yourself.

However, server_name does take wild cards, and you can do regular expression matching on $host. As I have done in my original post.

Posted at Nginx Forum:,3722,3807#msg-3807

More information about the nginx mailing list