【发布时间】:2014-02-03 19:42:55
【问题描述】:
我们在生产环境中使用以下 nginx 站点配置文件。
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time';
server {
root /srv/www/web;
server_name *.test.com;
access_log /var/log/nginx/xxx.test.com.access.log main;
“http://a.test.com/ping”和“http://b.test.com/ping”http请求都会记录在xxx.test.com.access.log文件中。
但是有一个问题,nginx没有在xxx.test.com.access.log中存储“域名”。
“http://a.test.com/ping”和“http://b.test.com/ping”共享同一个请求“Get /ping”。
如何在 nginx 日志中记录“a.test.com”或“b.test.com”?
【问题讨论】:
标签: nginx