Variables in access_log

merlin corey merlincorey at
Tue Jul 7 04:41:40 MSD 2009

I believe server_name now supports some variables but maybe this is
just in development branch.  The official documentation is in Russian
and located at .  There is also a wiki at with English and Chinese translations of some of
the documentation, but it is not always up to date or complete.
Google translate can do a readable job in many cases, and the
configuration language is always the same in any language, plus there
is the common language C that nginx is written in.  These are the
sources you should look through.

Completely separately regarding configurations, I am under the
understanding that nginx performs better with fully specified server
names.  It should be easy enough to put common configuration into
files which you include in each server { } block as necessary.  This
can easily be generated by a script so you don't have to do it by hand
if you have a lot of domains.  The benefits are you get the common
configuration, separate error logging, separate access logging, and
flexibility to make individual host changes while efficiently
selecting proper server blocks.

-- Merlin

On 7/5/09, batrick <nginx-forum at> 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.
> 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?
> Kind regards,
> batrick
> Posted at Nginx Forum:,3722,3763#msg-3763

More information about the nginx mailing list