Chinaunix首页 | 论坛 | 博客
  • 博客访问: 663674
  • 博文数量: 198
  • 博客积分: 4256
  • 博客等级: 上校
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-15 13:12
文章分类

全部博文(198)

文章存档

2012年(12)

2011年(39)

2010年(135)

2009年(12)

我的朋友

分类: LINUX

2010-05-22 08:39:26

官网地址:

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"

阅读(621) | 评论(0) | 转发(1) |
0

上一篇:http header详解

下一篇:nginx 内置变量大全

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