在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Variables The core module supports built-in variables, whose names correspond with the names of variables in Apache. First of all, there are the variables, which represent the lines of the title of the client request, for example, $http_user_agent, $http_cookie, and so forth. Furthermore, there are other variables: This variable contains the value of the GET request variable PARAMETER if present in the query string This variable is equal to arguments in the line of request; The address of the client in binary form; (undocumented) This variable is equal to line Content-Length in the header of request; This variable is equal to line Content-Type in the header of request; The value of the cookie COOKIE; This variable is equal to the value of directive root for the current request; The same as $uri. This variable is equal to line Host in the header of request or name of the server processing the request if the Host header is not available. This variable may have a different value from $http_host when the Host input header is absent or has an empty value. The value of the HTTP header HEADER when converted to lowercase and with ‘dashes' converted to ‘underscores', e.g. $http_user_agent, $http_referer…; Evaluates to “?” if $args is set, “” otherwise. This variable allows limiting the connection rate. The same as $args. The address of the client. The port of the client; This variable is equal to the name of user, authenticated by the Auth Basic Module; This variable is equal to path to the file for the current request, formed from directives root or alias and URI request; This variable(0.7.58+) contains the body of the request. The significance of this variable appears in locations with directives proxy_pass or fastcgi_pass. Client request body temporary filename; (undocumented) This variable is equal to the method of request, usually GET or POST. Before and including 0.8.20, this variable always evaluates to the method name of the main request, not the current request if the current request is a subrequest. This variable is equal to the complete initial URI together with the arguments; The HTTP scheme (i.e. http, https). Evaluated only on demand, for example: rewrite ^(.+)$ $scheme://example.com$1 redirect; Edit section: $server_addr $server_addr Equal to the server address. As a rule, for obtaining the value of this variable is done one system call. In order to avoid system call, it is necessary to indicate addresses in directives listen and to use parameter bind. The name of the server. This variable is equal to the port of the server, to which the request arrived; This variable is equal to the protocol of request, usually this HTTP/1.0 or HTTP/1.1. This variable is equal to current URI in the request, it can differ from initial, for example by internal redirects, or with the use of index it is file with internal redirects. 参考: http://www.givingtree.com.cn/entry/Nginx-Location%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95 http://wiki.nginx.org/NginxHttpCoreModule#Variables
$args 此变量与请求行中的参数相等 $content_length 等于请求行的“Content_Length”的值。 $content_type 等同与请求头部的”Content_Type”的值 $document_root 等同于当前请求的root指令指定的值 $document_uri 与$uri一样 $host 与请求头部中“Host”行指定的值或是request到达的server的名字(没有Host行)一样 $limit_rate 允许限制的连接速率 $request_method 等同于request的method,通常是“GET”或“POST” $remote_addr 客户端ip $remote_port 客户端port $remote_user 等同于用户名,由ngx_http_auth_basic_module认证 $request_filename 当前请求的文件的路径名,由root或alias和URI request组合而成 $request_body_file $request_uri 含有参数的完整的初始URI $query_string 与$args一样 $server_protocol 等同于request的协议,使用“HTTP/1.0”或“HTTP/1.1” $server_addr request到达的server的ip,一般获得此变量的值的目的是进行系统调用。为了避免系统调用,有必要在listen指令中指明ip,并使用bind参数。 $server_name 请求到达的服务器名 $server_port 请求到达的服务器的端口号 $uri 等同于当前request中的URI,可不同于初始值,例如内部重定向时或使用index |
请发表评论