TCP连接相关变量
地址
remote_addr- 客户端 ip 地址
remote_port- 客户端 端口
server_addr- 服务端 ip 地址
serer_port- 服务端端口
server_protocol- 服务端协议
binary_remote_addr- 二进制格式的客户端 ip 地址
connection- tcp 连接的序列号
connection_request- tcp 连接当前的请求数量
proxy_protocol_addr- 如果使用 proxy_protocol 协议,返回协议地址,否则返回空
proxy_protocol_port- 如果使用 proxy_protocol 协议,返回协议端口,否则返回空
发送HTTP请求变量
uri- 请求的 url,不包含参数
request_uri- 请求的 url,包含参数
scheme- 协议名,http or https
request_method- 请求方法
request_length- 请求长度,包括请求行、头、体
args- 全部参数字符串
arg_<参数值>- 特定参数值
is_args- URL 是否有参数,有则返回
?,无则返回空
- URL 是否有参数,有则返回
query_string- 全部参数字符串
remote_user- Http Basic Authentication 协议传入的用户名
经过 nginx 后可能被修改的变量
host- 先看请求行,再看请求头,最后找 server_name
http_<请求头某个 field>- request header 中的某个 field
http_user_agent- 用户浏览器
http_referer- 从哪些链接过来的请求
http_via- 经过一层代理服务器,追加对应代理服务器的信息
http_x_forwarded_for- 获取用户真实 ip
http_cookie- 用户 cookie
处理HTTP请求变量
request_time- 处理请求已耗费时间
request_completion- 处理请求完成返回
OK,否则返回 空
- 处理请求完成返回
server_name- 匹配上请求的 server_name 值
https- 如果开启 https 返回 on,否则返回空
request_filename- 磁盘文件系统待访问文件的完整路径
document_root- 由 URL 和 root/alias 规则生成的文件夹路径
realpath_root- 将 document_root 中的软链接换成真实路径
limit_rate- 返回响应时的速度上限值
