Nginx(五):nginx日志
看例子:
修改nginx.conf 添加红色部分
log_format main '$http_user_agent' '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
访问地址 获取详细信息
[root@smoker-linux nginx]# curl -v http://127.0.0.1
* About to connect() to 127.0.0.1 port 80 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1
> Accept: */*
日志信息('$http_user_agent' --》 User-Agent)
curl/7.29.0127.0.0.1 - - [11/Jul/2018:17:24:05 +0800] "GET / HTTP/1.1" 200 673 "-" "curl/7.29.0" "-"
$remote_addr 客户端地址
$remote_user 请求NGINX认证的用户名
$time_local nginx时间
$request request头的请求行
$status reponse返回的状态
$body_bytes_sent 服务端响应给客户端body信息的大小
$http_referer 上一级url地址(上一级页面)
$http_x_forwarded_for http协议的
$http_user_agent 客户端的User-Agent信息
$http_x_forwarded_for http请求头携带的信息
浙公网安备 33010602011771号