I have configured my nginx vhosts with a regex in server_name. nginx shows the raw regex in logs and in params passed to php-fpm (I know there’s
$_SERVER['HTTP_HOST'] with a real value, that’s not an issue). My question is how can I get nginx to put the real hostname to logs, instead of the regex.
The server_name directive looks like this:
$http_host in your
log_format to get the actual host that the client sent.
You can also use that variable in
access_log directives to split your logs by hostname.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.