zoukankan      html  css  js  c++  java
  • nginx全局变量实例对照 rewrite参考手册

    http://dwz.stamhe.com/index.php?_a=index&_m=show&count=10
    remote_addr		客户端ip,如:192.168.4.2
    binary_remote_addr	客户端ip(二进制)
    remote_port		客户端port,如:50472
    remote_user		已经经过Auth Basic Module验证的用户名
    host			请求主机头字段,否则为服务器名称,如:dwz.stamhe.com
    request			用户请求信息,如:GET /?_a=index&_m=show&count=10 HTTP/1.1
    request_filename	当前请求的文件的路径名,由root或alias和URI request组合而成,如:/webserver/htdocs/dwz/index.php
    status			请求的响应状态码,如:200
    body_bytes_sent	响应时送出的body字节数数量。即使连接中断,这个数据也是精确的,如:40
    content_length	请求头中的Content-length字段
    content_type	请求头中的Content-Type字段
    http_referer	引用地址
    http_user_agent	客户端agent信息,如:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
    args			如:_a=index&_m=show&count=10
    document_uri	与$uri相同,如:/index.php
    document_root	针对当前请求的根路径设置值,如:/webserver/htdocs/dwz
    hostname		如:centos53.localdomain
    http_cookie		客户端cookie信息
    cookie_COOKIE	cookie COOKIE变量的值
    is_args			如果有$args参数,这个变量等于”?”,否则等于”",空值,如?
    limit_rate		这个变量可以限制连接速率,0表示不限速
    query_string	与$args相同,如:_a=index&_m=show&count=10
    realpath_root	如:/webserver/htdocs/dwz
    request_body	 记录POST过来的数据信息
    request_body_file	客户端请求主体信息的临时文件名
    request_method	客户端请求的动作,通常为GET或POST,如:GET
    request_uri		包含请求参数的原始URI,不包含主机名,如:”/foo/bar.php?arg=baz”。不能修改。如:/index.php?_a=index&_m=show&count=10
    scheme			HTTP方法(如http,https),如:http
    uri				如:/index.php
    request_completion	如果请求结束,设置为OK. 当请求未结束或如果该请求不是请求链串的最后一个时,为空(Empty),如:OK
    server_protocol	请求使用的协议,通常是HTTP/1.0或HTTP/1.1,如:HTTP/1.1
    server_addr		服务器地址,在完成一次系统调用后可以确定这个值,如:192.168.4.129
    server_name		服务器名称,如:dwz.stamhe.com
    server_port		请求到达服务器的端口号,如:80

    转:http://www.linuxidc.com/Linux/2015-06/119398.htm

    全局变量

    下面是可以用作if判断的全局变量

    • $args : #这个变量等于请求行中的参数,同$query_string
    • $content_length : 请求头中的Content-length字段。
    • $content_type : 请求头中的Content-Type字段。
    • $document_root : 当前请求在root指令中指定的值。
    • $host : 请求主机头字段,否则为服务器名称。
    • $http_user_agent : 客户端agent信息
    • $http_cookie : 客户端cookie信息
    • $limit_rate : 这个变量可以限制连接速率。
    • $request_method : 客户端请求的动作,通常为GET或POST。
    • $remote_addr : 客户端的IP地址。
    • $remote_port : 客户端的端口。
    • $remote_user : 已经经过Auth Basic Module验证的用户名。
    • $request_filename : 当前请求的文件路径,由root或alias指令与URI请求生成。
    • $scheme : HTTP方法(如http,https)。
    • $server_protocol : 请求使用的协议,通常是HTTP/1.0或HTTP/1.1。
    • $server_addr : 服务器地址,在完成一次系统调用后可以确定这个值。
    • $server_name : 服务器名称。
    • $server_port : 请求到达服务器的端口号。
    • $request_uri : 包含请求参数的原始URI,不包含主机名,如:”/foo/bar.php?arg=baz”。
    • $uri : 不带请求参数的当前URI,$uri不包含主机名,如”/foo/bar.html”。
    • $document_uri : 与$uri相同。

    例:http://localhost:88/test1/test2/test.php

    1. $hostlocalhost
    2. $server_port88
    3. $request_urihttp://localhost:88/test1/test2/test.php
    4. $document_uri:/test1/test2/test.php
    5. $document_root:/var/www/html
    6. $request_filename:/var/www/html/test1/test2/test.php
  • 相关阅读:
    作业
    bash陷阱
    Hive
    工作小结
    Python脚本没有实时print信息
    Ubuntu下apt-get遇到Hash Sum Mismatch
    微信小程序要2017-01-19号发布!
    flex布局学习(四)flex色子布局练习
    flex布局学习(三)
    flex布局学习(二)
  • 原文地址:https://www.cnblogs.com/swing07/p/5394915.html
Copyright © 2011-2022 走看看