Nginx built-in variables
Built-in variables are stored in the Ngx_http_core_module module, and the variables are named in the same way as the Apache server variables. In summary, these variables represent the contents of the client request header, such as $http_user_agent, $http _cookie, and so on. The following are all built-in variables supported by Nginx:
$arg _name
The name of the parameter in the request, which is "?" Behind the Arg_name=arg_value form of the Arg_name
$args: Parameter values in the request
$binary _remote_addr: The binary form of the client address with a fixed length of 4 bytes
$body _bytes_sent: The number of bytes transmitted to the client, the response header is not counted, and this variable is compatible with the "%B" parameter in Apache's Mod_log_config module
$bytes _sent: Number of bytes transmitted to the client (1.3.8, 1.2.5)
$connection
Serial number of the TCP connection (1.3.8, 1.2.5)
$connection _requests
The current number of requests for TCP connections (1.3.8, 1.2.5)
$content _length
"Content-length" Request header Field
$content _type
"Content-type" Request header Field
$cookie _name
Cookie Name
$document _root
The document root or alias of the current request
$document _uri
Same $uri
$host
The priority is as follows: The host name of the HTTP request line > the "Host" Request header field > The server name that matches the request
$hostname
Host Name
$http _name
Match any Request header field, the second half of the variable name "name" can be replaced by any request header field, such as the need to get HTTP request header in the configuration file: "Accept-language", then "-" replaced by an underscore, uppercase letters replaced by lowercase, such as: $http _ Accept_language can be.
$https
If SSL Safe mode is turned on, the value is "on", otherwise it is an empty string.
$is _args
If there is a parameter in the request, the value is "?", otherwise an empty string.
$limit _rate
To set the speed limit for the response, see Limit_rate.
$msec
Current UNIX timestamp (1.3.9, 1.2.6)
$nginx _version
Nginx version
$pid
PID of the work process
$pipe
If the request is from a pipe communication, the value is "P", otherwise "." (1.3.12, 1.2.7)
$proxy _protocol_addr
Gets the client address of the proxy access server, which is an empty string if it is accessed directly. (1.5.12)
$query _string
Same $args
$realpath _root
The actual path of the document root or alias of the current request, converting all symbolic connections to the true path.
$remote _addr
Client Address
$remote _port
Client Port
$remote _user
User name for HTTP Basic Authentication Service
$request
Request address on behalf of client
$request _body
The client's request body
This variable can be used in location, passing the request principal through Proxy_pass, Fastcgi_pass, Uwsgi_pass, and Scgi_pass to the next level of proxy server.
$request _body_file
Save the client request principal in a temporary file. This file needs to be deleted after the file processing is finished. If you need to turn this feature on, you need to set client_body_in_file_only. If the secondary file is passed to the back-end proxy server, you need to disable the request body, which is set proxy_pass_request_body off,fastcgi_pass_request_body off, Uwsgi_pass_ Request_body off, or scgi_pass_request_body off.
$request _completion
If the request succeeds, the value is "OK" and is empty if the request is not completed or the request is not the last part of a range request.
$request _filename
The file path of the current connection request, generated by the root or alias directive and the URI request.
$request _length
The length of the request (including the requested address, HTTP request header, and request body) (1.3.12, 1.2.7)
$request _method
HTTP request method, usually "GET" or "POST"
$request _time
Processing time for client requests (1.3.9, 1.2.6); Begins the timing of the first byte of the read client.
$request _uri
This variable equals the original URI that contains some client request parameters, it cannot be modified, see $uri change or rewrite the URI, not including the hostname, for example: "/cnphp/test.php?arg=freemouse".
$scheme
The Web protocol used by the request, "http" or "https"
$sent _http_name
You can set any HTTP response header field, the second half of the variable name can be replaced with any response header field, if you need to set the response header content-length, then "-" is replaced by an underscore, uppercase letters are replaced by lowercase, such as: $sent _HTTP_ Content_length 4096.
$server _addr: Server-side address, it is important to note that in order to avoid access to the Linux system kernel, the IP address should be set in advance in the configuration file.
$server _name: server name, Www.cnphp.info
$server _port: Server port
$server _protocol: HTTP version of the server, usually "http/1.0" or "http/1.1"
$status: HTTP response code (1.3.2, 1.2.2)
$tcpinfo _rtt, $tcpinfo _rttvar, $tcpinfo _snd_cwnd, $tcpinfo _rcv_space: Specific information for client TCP connections
$time _iso8601: ISO 8610 format for server time (1.3.12, 1.2.7)
$time _local: Server time (LOG format) (1.3.12, 1.2.7)
$uri: The current URI in the request (without the request parameter, the parameter is in $args), can be different from the value of the $request_uri passed by the browser, it can be changed by internal redirection, or by using the index directive, $uri does not include the hostname, such as "/foo/ Bar.html ".
Nginx built-in variables