首页 > 网站 > Nginx > 正文

Nginx中全局变量整理小结

2024-08-30 12:27:21
字体:
来源:转载
供稿:网友

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:
Edit section: $arg_PARAMETER $arg_PARAMETER

This variable contains the value of the GET request variable PARAMETER if present in the query string
Edit section: $args $args

This variable is equal to arguments in the line of request;
Edit section: $binary_remote_addr $binary_remote_addr

The address of the client in binary form;
Edit section: $body_bytes_sent $body_bytes_sent

(undocumented)
Edit section: $content_length $content_length

This variable is equal to line Content-Length in the header of request;
Edit section: $content_type $content_type

This variable is equal to line Content-Type in the header of request;
Edit section: $cookie_COOKIE $cookie_COOKIE

The value of the cookie COOKIE;
Edit section: $document_root $document_root

This variable is equal to the value of directive root for the current request;
Edit section: $document_uri $document_uri

The same as $uri.
Edit section: $host $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.
Edit section: $http_HEADER $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…;
Edit section: $is_args $is_args

Evaluates to “?” if $args is set, “” otherwise.
Edit section: $limit_rate $limit_rate

This variable allows limiting the connection rate.
Edit section: $query_string $query_string

The same as $args.
Edit section: $remote_addr $remote_addr

The address of the client.
Edit section: $remote_port $remote_port

The port of the client;
Edit section: $remote_user $remote_user

This variable is equal to the name of user, authenticated by the Auth Basic Module;
Edit section: $request_filename $request_filename

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

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.
Edit section: $request_body_file $request_body_file

Client request body temporary filename;
Edit section: $request_completion $request_completion

(undocumented)
Edit section: $request_method $request_method

This variable is equal to the method of request, usually GET or POST.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表