nginx nginx built-in variables built-in variables

nginx built-in variables

 

Built-in variables stored in ngx_http_core_module module, named apache server variables and variables are the same. Taken together, these variables represent the client request header content, such as $ http_user_agent, $ http_cookie, and so on. Here is nginx support for all built-in variables:

 

$arg_name
Parameter name request, ie "?" Behind the arg_name = arg_value form of arg_name

$args
Request parameter values

$binary_remote_addr
The client address in binary form, a fixed length of 4 bytes

$body_bytes_sent
Number of bytes transmitted to the client, not counting the first response; variable and Apache mod_log_config module "% B" parameter compatibility

$bytes_sent
The number of bytes transmitted to the client (1.3.8, 1.2.5)

$connection
TCP sequence number (1.3.8, 1.2.5) connected

$connection_requests
The current number of requests the TCP connection (1.3.8, 1.2.5)

$content_length
"Content-Length" header field in the request

$content_type
"Content-Type" header field Request

$cookie_name
cookie name

$document_root
The current request document root or alias

$document_uri
The $ uri

$host
Priority is as follows: HTTP request line hostname> "HOST" request header field> server name in line with the request

$hostname
CPU name

$http_name
Matches any request header field; the second half of the variable name in "name" can be replaced with any request header fields, such as the need to obtain the configuration file http request header: "Accept-Language", then the "-" replaced by an underscore, Alternatively uppercase to lowercase, the form: $ http_accept_language can.

$https
If you turn SSL security mode is "on", otherwise empty string.

$is_args
If there is a request parameter value "?", Otherwise empty string.

$limit_rate
Setting the speed limit for the response, detailed limit_rate.

$msec
The current Unix timestamp (1.3.9, 1.2.6)

$nginx_version
nginx version

$pid
PID process work

$pipe
If the communication request from the conduit, the value "p", otherwise "." (1.3.12, 1.2.7)

$proxy_protocol_addr
Get access to the proxy server address of the client, if it is a direct access, the value is an empty string. (1.5.12)

$query_string
With $ args

$realpath_root
The real path or document root alias the current request, the connection will convert all symbols true path.

$remote_addr
Client Address

$remote_port
Client Port

$remote_user
User name for HTTP basic authentication services

$request
On behalf of the client request address

$request_body
Client request body
this variable can be used in location, a transfer request body proxy_pass, fastcgi_pass, uwsgi_pass, and scgi_pass to the next stage through the proxy server.

$request_body_file
The client request body is stored in a temporary file. After the file handle, the file to be deleted. If one needs to turn this feature on, you need to set client_body_in_file_only. If the file transfer times to the back-end proxy server, you need to disable the request body, that 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 "OK", or if the request did not complete the last part of the request, a null range is not requested.

$request_filename
The file path of the current connection request, or a request by the root URI to the alias command generation.

$request_length
The length of the request (including the requested address, and the request body HTTP request header) (1.3.12, 1.2.7)

$request_method
The HTTP request method, is generally "GET" or "POST"

$request_time
Processing client requests time (1.3.9, 1.2.6) used; read from the first byte of a client starts.

$request_uri
This variable is equal to contain some of the original client request URI parameters, it can not be modified, please see the $ uri URI change or rewrite, does not include the host name, for example: "? / Cnphp / test.php arg = freemouse".

$scheme
Request Web protocol used, "http" or "https"

$sent_http_name
Http response header may be provided in any field; the second half of the variable name in "name" can be replaced by any response header field, such as the need to set the response header Content-length, then the "-" is replaced by an underscore, replacing uppercase to lowercase of the form: $ sent_http_content_length 4096 can be.

$server_addr
The server address, should be noted that: In order to avoid access linux kernel, 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 about the client TCP connection

$time_iso8601
The ISO 8610 format server time (1.3.12, 1.2.7)

$time_local
Server Time (LOG Format format) (1.3.12, 1.2.7)

$uri
The current request URI (without request parameters parameters are in the $ args), may be different from the value of $ REQUEST_URI browser transmission, which can be internal redirect, modify or use index instruction, $ URI does not contain a host name, such as "/foo/bar.html".

 

Built-in variables stored in ngx_http_core_module module, named apache server variables and variables are the same. Taken together, these variables represent the client request header content, such as $ http_user_agent, $ http_cookie, and so on. Here is nginx support for all built-in variables:

 

$arg_name
Parameter name request, ie "?" Behind the arg_name = arg_value form of arg_name

$args
Request parameter values

$binary_remote_addr
The client address in binary form, a fixed length of 4 bytes

$body_bytes_sent
Number of bytes transmitted to the client, not counting the first response; variable and Apache mod_log_config module "% B" parameter compatibility

$bytes_sent
The number of bytes transmitted to the client (1.3.8, 1.2.5)

$connection
TCP sequence number (1.3.8, 1.2.5) connected

$connection_requests
The current number of requests the TCP connection (1.3.8, 1.2.5)

$content_length
"Content-Length" header field in the request

$content_type
"Content-Type" header field Request

$cookie_name
cookie name

$document_root
The current request document root or alias

$document_uri
The $ uri

$host
Priority is as follows: HTTP request line hostname> "HOST" request header field> server name in line with the request

$hostname
CPU name

$http_name
Matches any request header field; the second half of the variable name in "name" can be replaced with any request header fields, such as the need to obtain the configuration file http request header: "Accept-Language", then the "-" replaced by an underscore, Alternatively uppercase to lowercase, the form: $ http_accept_language can.

$https
If you turn SSL security mode is "on", otherwise empty string.

$is_args
If there is a request parameter value "?", Otherwise empty string.

$limit_rate
Setting the speed limit for the response, detailed limit_rate.

$msec
The current Unix timestamp (1.3.9, 1.2.6)

$nginx_version
nginx version

$pid
PID process work

$pipe
If the communication request from the conduit, the value "p", otherwise "." (1.3.12, 1.2.7)

$proxy_protocol_addr
Get access to the proxy server address of the client, if it is a direct access, the value is an empty string. (1.5.12)

$query_string
With $ args

$realpath_root
The real path or document root alias the current request, the connection will convert all symbols true path.

$remote_addr
Client Address

$remote_port
Client Port

$remote_user
User name for HTTP basic authentication services

$request
On behalf of the client request address

$request_body
Client request body
this variable can be used in location, a transfer request body proxy_pass, fastcgi_pass, uwsgi_pass, and scgi_pass to the next stage through the proxy server.

$request_body_file
The client request body is stored in a temporary file. After the file handle, the file to be deleted. If one needs to turn this feature on, you need to set client_body_in_file_only. If the file transfer times to the back-end proxy server, you need to disable the request body, that 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 "OK", or if the request did not complete the last part of the request, a null range is not requested.

$request_filename
The file path of the current connection request, or a request by the root URI to the alias command generation.

$request_length
The length of the request (including the requested address, and the request body HTTP request header) (1.3.12, 1.2.7)

$request_method
The HTTP request method, is generally "GET" or "POST"

$request_time
Processing client requests time (1.3.9, 1.2.6) used; read from the first byte of a client starts.

$request_uri
This variable is equal to contain some of the original client request URI parameters, it can not be modified, please see the $ uri URI change or rewrite, does not include the host name, for example: "? / Cnphp / test.php arg = freemouse".

$scheme
Request Web protocol used, "http" or "https"

$sent_http_name
Http response header may be provided in any field; the second half of the variable name in "name" can be replaced by any response header field, such as the need to set the response header Content-length, then the "-" is replaced by an underscore, replacing uppercase to lowercase of the form: $ sent_http_content_length 4096 can be.

$server_addr
The server address, should be noted that: In order to avoid access linux kernel, 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 about the client TCP connection

$time_iso8601
The ISO 8610 format server time (1.3.12, 1.2.7)

$time_local
Server Time (LOG Format format) (1.3.12, 1.2.7)

$uri
The current request URI (without request parameters parameters are in the $ args), may be different from the value of $ REQUEST_URI browser transmission, which can be internal redirect, modify or use index instruction, $ URI does not contain a host name, such as "/foo/bar.html".

Guess you like

Origin www.cnblogs.com/lgj8/p/12097063.html