How to log virtual server name

B.R. reallfqq-nginx at
Wed Aug 7 19:44:13 UTC 2013


On Wed, Aug 7, 2013 at 3:09 PM, Roger Pack <lists at> wrote:

> seems for me that any of these work for showing the virtual host (for
> followers).
> $http_host $host $server_name
> ​The Nginx docs specifies different content for those 3 variables.
The $http_host is a subset of the possible values that $host can take.
$server_name might not reflect what you wish: it will send literally the
line which is in the server configuration. It it contains a regular
expression, for instance, you'll get it as you typed it in...

> I just had to uncomment this line for it to 'take', oddly:
>  #access_log  logs/access.log  main;
> @nginx dev guys:  it would be nice if the default config either
> mentioned that both log_format and access_log (commented out) lines need
> to be uncommented to take, or for them both to start uncommented
> avoid this confusion for others in the future...
> --
> Posted via
> _______________________________________________
> nginx mailing list
> nginx at

*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list