I have set up nginx for some sites. In their .conf files, there can be server_name with multiple domains. However, when checking the log file, the domain name can't be identified. Is it possible to find out which domain?
Asked
Active
Viewed 2,521 times
1 Answers
1
Yes you can!
you should add $server_name in your log_format sentence. Could looks like
log_format compression '$server_name $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
and after reload nginx you should be able to see the server name on your access log

Josh Crozier
- 233,099
- 56
- 391
- 304

Horacio
- 2,865
- 1
- 14
- 24
-
Tks for answer, too bad i don't have permission to change the log_format – nkt Jul 29 '15 at 03:12
-
@nkt you could create your own format. And it's probably better to use $host variable – Alexey Ten Jul 29 '15 at 04:28