Home  >  Article  >  Operation and Maintenance  >  Describe nginx’s built-in variables in detail

Describe nginx’s built-in variables in detail

巴扎黑
巴扎黑Original
2017-08-17 10:36:271727browse

The built-in variables that can be used in the nginx configuration file start with the dollar sign $, and some people call them global variables. Among them, the values ​​of some predefined variables can be changed.

$arg_PARAMETER The value of this variable is: the value of the variable name PARAMETER parameter in the GET request.

$args This variable is equal to the parameters in the GET request. For example, foo=123&bar=blahblah;This variable can only be modified

$binary_remote_addr The client address in binary code form.

$body_bytes_sent The number of bytes of the transmitted page

$content_length The Content-length field in the request header.

$content_type Content-Type field in the request header.

$cookie_COOKIE The value of cookie COOKIE.

$document_root The value specified in the root directive is currently requested.

$document_uri is the same as $uri.

$host The host header (Host) field in the request. If the host header in the request is unavailable or empty, it is the name of the server that processes the request (the value of the server_name directive of the server that processes the request). Values ​​are lowercase and do not include ports.

$hostname The machine name uses the value of the gethostname system call

$http_HEADER The content in the HTTP request header, HEADER is the content in the HTTP request converted to lowercase, - becomes _ (dash becomes Underscore), for example: $http_user_agent (value of Uaer-Agent), $http_referer...;

$sent_http_HEADER The content in the HTTP response header, HEADER is the content in the HTTP response, converted to lowercase, - becomes _ (dash changes to underscore), for example: $sent_http_cache_control, $sent_http_content_type...;

$is_args If $args is set, the value is "?", otherwise it is "".

$limit_rate This variable can limit the connection rate.

$nginx_version The currently running nginx version number.

$query_string is the same as $args.

$remote_addr The IP address of the client.

$remote_port The port of the client.

$remote_user Username that has been verified by Auth Basic Module.

$request_filename The file path of the current connection request, generated by the root or alias directive and URI request.

$request_body This variable (0.7.58+) contains the main information of the request. Makes sense in locations using proxy_pass or fastcgi_pass directives.

$request_body_file The temporary file name of the client request body information.

$request_completion Set to "OK" if the request is successful; set to empty if the request is not completed or is not the last part of a series of requests.

$request_method This variable is the action requested by the client, usually GET or POST.

Including versions 0.8.20 and earlier, this variable is always the action in the main request. If the current request is a subrequest, the action of the current request is not used.

$request_uri This variable is equal to the original URI containing some client request parameters. It cannot be modified. Please see $uri to change or rewrite the URI.

$scheme protocol used, such as http or https, such as rewrite ^(.+)$ $scheme://example.com$1 redirect;

$server_addr server address, after completion This value can be determined after a system call. If you want to bypass the system call, you must specify the address in listen and use the bind parameter.

$server_name Server name.

$server_port The port number where the request reaches the server.

$server_protocol The protocol used by the request, usually HTTP/1.0 or HTTP/1.1.

$uri The current URI in the request (without request parameters, the parameters are located in $args) is different from the value of $request_uri passed by the browser. It can be modified through internal redirection or using the index directive. Exclude protocol and hostname, for example /foo/bar.html

The above is the detailed content of Describe nginx’s built-in variables in detail. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn