1、产生access.log的配置
获取客户端访问用户的信息
log_format main
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main; #设置访问日志的路径和格式
2、参数1
参数名 | 意义 |
$arg_PARAMETER | HTTP请求中的某个参数的值,举例:/index.html?size=100, $arg_size的值为100 |
$args | HTTP请求中的完整参数。如: /index.html?width=30&height=50,$args表示字符串 width=30&height=50 |
$binary_remote_addr | 二进制格式的客户端地址。例如:\x0A\xE0B\x0E |
$body_bytes_sent | 在向客户端发送的http响应中,包体部分的字节数 |
$content_length | 客户端请求头部中的Content-Length字段 |
$content_type | 客户端请求头部中的Content_Type字段 |
$cookis_COOKIE | 客户端请求头部中的cookie字段 |
参数名 | 意义 |
$document_root | 当前请求所使用的root配置项的值 |
$uri $document_uri | 表示当前请求URI,不带任何参数 |
$request_uri | 客户端发送的原始请求uri,带完整参数 |
$host | 客户端请求头中的host字段 |
$hostname | 表示NginX所在机器的名称 |
$http_HEADER | 当前HTTP请求中响应头部的值。HEADER名称全小写。 |
$sent_http_HEADER | 表示返回客户端的HTTP响应中响应头部的值。 |
$is_args | 表示请求中的URI是否带参数,如果带参数,$is_args值 为?,否则为空字符串。 |
参数名 | 意义 |
$limit_rate | 表示当前链接的限速,0表示无限速 |
$nginx_version | 当前NginX的版本号 |
$query_string | 请求URI中的参数,与$args相同,但该参数只读 |
$remote_addr | 客户端地址 |
$remote_port | 客户端连接使用的端口 |
$remote_user | 使用Auth Basic Module时定义的用户名。 |
$request_filename | 用户请求中的URI经过root或alias转换后的文件路径。 |
$request_body | HTTP请求中的包体,该参数只在proxy_pass或fastcgi_pass中有意 义。 |
$request_body_file | HTTP请求中的包体存储的临时文件名 |
参数名 | 意义 |
$request_completion | 当请求全部完成,其值为“ok”。否则返回客户端空字符串 |
$request_method | HTTP请求的方法名,如:GET、PUT、POST等 |
$scheme | HTTP scheme,在请求https://nginx.com/ 中表示https |
$server_addr | 服务器地址 |
$server_port | 服务器端口 |
$server_name | 服务器名称。 |
$server_protocol | 服务器协议。 |
文章评论