nginx默认的log format没有记录请求的协议类型,比如是http还是https。
做如下配置:
log_format main_log '$remote_addr - $remote_user [$time_local]
$scheme "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'up_addr["$upstream_addr"] up_status[$upstream_status] '
'up_response_time[$upstream_response_time]';
access_log logs/access.log main_log;
其中的 $scheme 来记录协议类型。
这样在access.log中就会出现类似记录:
xxxxxx xxx xxxxx https xxxxx xxxxxx