Separate logs within the same server for different server names?

Lucas Rolff lucas at
Thu Jun 15 11:17:41 UTC 2017

"The file path can contain variables (0.7.6+), but such logs have some constraints"

So yes, you can use things such as $host - but there will be a performance penalty.

On 15/06/2017, 13.02, "nginx on behalf of ST" <nginx-bounces at on behalf of smntov at> wrote:

>is it possible somehow to define separate logs within the same server{}
>for different server names (server_name;)?
>access_log /var/log/nginx$server_name/access.log;
>error_log /var/log/nginx$server_name/error.log;
>Thank you!
>nginx mailing list
>nginx at

More information about the nginx mailing list