How to log virtual server name

Igor Sysoev igor at sysoev.ru
Mon Feb 27 06:22:39 UTC 2012


On Mon, Feb 27, 2012 at 06:18:00AM +0000, Lucian D. Kafka wrote:
> Hi All,
> 
> We have a virtual hosting setup where multiple domains are delegated to the same server IP address, and Nginx acts as a caching proxy server in front of the  web server.
> 
> I am encountering 2 issues:
> 
> 1.       Cannot set more than 1 server name - Nginx is ignoring multiple server names defined on the same IP with a warning message

This may help:
http://nginx.org/en/docs/http/server_names.html

> 2.       Cannot log the virtual server name (Apache %v equivalent) to the access_log. Any variable in the custom log format - ie. $server_name, $host, etc does not log the Host headers, but rather the server name string set with the server_name directive (if matched). This makes it impossible to have a combined log file for different sites set in a virtual hosting environment on the same IP address.

$http_host.


-- 
Igor Sysoev



More information about the nginx mailing list