Chinaunix首页 | 论坛 | 博客
  • 博客访问: 454612
  • 博文数量: 481
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1040
  • 用 户 组: 普通用户
  • 注册时间: 2013-01-06 14:09
文章分类

全部博文(481)

文章存档

2013年(483)

我的朋友

分类: LINUX

2013-02-28 12:49:55

原文地址:nginx Variables 作者:jack_sir

官网地址:

The core module supports built-in variables, whose names correspond with the names of variables in Apache.

First of all, there are variables which represent header lines in the client request, for example, $http_user_agent, $http_cookie, and so forth. Note that because these correspond to what the client actually sends, they are not guaranteed to exist and their meaning is defined elsewhere (e.g. in relevant standards).

Furthermore, there are other variables:

$arg_PARAMETER

This variable contains the value of the GET request variable PARAMETER if present in the query string

$args

This variable is the GET parameters in request line, e.g. foo=123&bar=blahblah;

$binary_remote_addr

The address of the client in binary form;

$body_bytes_sent

The amount of bytes sent as part of the body of the response. Is accurate even when connections are aborted or interrupted.

$content_length

This variable is equal to line Content-Length in the header of request;

$content_type

This variable is equal to line Content-Type in the header of request;

$cookie_COOKIE

The value of the cookie COOKIE;

$document_root

This variable is equal to the value of directive  for the current request;

$document_uri

The same as .

$host

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.

$hostname

Set to the machine's hostname as returned by 

$http_HEADER

The value of the HTTP header HEADER when converted to lowercase and with 'dashes' converted to 'underscores', e.g. $http_user_agent, $http_referer...;

$is_args

Evaluates to "?" if  is set, "" otherwise.

$limit_rate

This variable allows limiting the connection rate.

$nginx_version

The version of Nginx that the server is currently running;

$query_string

The same as .

$remote_addr

The address of the client.

$remote_port

The port of the client;

$remote_user

This variable is equal to the name of user, authenticated by the ;

$request_filename

This variable is equal to path to the file for the current request, formed from directives root or alias and URI request;

$request_body

This variable(0.7.58+) contains the body of the request. The significance of this variable appears in locations with directives  or .

$request_body_file

Client request body temporary filename;

$request_completion

Set to "OK" if request was completed successfully. Empty if request was not completed or if request was not the last part of a series of range requests.

$request_method

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.

$request_uri

This variable is equal to the *original* request URI as received from the client including the args. It cannot be modified. Look at $uri for the post-rewrite/altered URI. Does not include host name. Example: "/foo/bar.php?arg=baz"

$scheme

The HTTP scheme (i.e. http, https). Evaluated only on demand, for example:

rewrite ^ $scheme://example.com$uri redirect;
$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  and to use parameter bind.

$server_name

The name of the server.

$server_port

This variable is equal to the port of the server, to which the request arrived;

$server_protocol

This variable is equal to the protocol of request, usually this HTTP/1.0 or HTTP/1.1.

$uri

This variable is equal to current URI in the request (without arguments, those are in $args.) It can differ from $request_uri which is what is sent by the browser. Examples of how it can be modified are internal redirects, or with the use of . Does not include host name. Example: "/foo/bar.html"

阅读(374) | 评论(0) | 转发(0) |
0

上一篇:nginx 内置变量大全

下一篇:http header详解

给主人留下些什么吧!~~