NGINX Variables

195 — Searchable variable reference across core HTTP, stream, and third-party modules — with examples and gotchas.

NGINX Core (HTTP)124

$arg_* The variable $arg_ retrieves the value of a specific query parameter from the… $args The $args variable contains the query string arguments of the request… $binary_remote_addr The $binary_remote_addr variable contains the binary representation of the… Cacheable $body_bytes_sent The $body_bytes_sent variable in NGINX contains the number of bytes sent to… Cacheable $bytes_sent The $bytes_sent variable contains the total number of bytes sent to the client… Cacheable $connection The $connection variable returns the connection descriptor number for the… Cacheable $connection_requests The $connection_requests variable returns the number of requests received on… Cacheable $connection_time The $connection_time variable returns the time taken to establish a connection… $content_length The variable $content_length contains the value of the 'Content-Length' HTTP… Cacheable $content_type The $content_type variable in NGINX holds the value of the Content-Type header… Cacheable $cookie_* The $cookie_ variable prefix is used to access the value of HTTP cookies sent… Cacheable $document_root The $document_root variable returns the root directory of the current server… $document_uri The $document_uri variable contains the URI of the request without any query… $fastcgi_path_info The variable $fastcgi_path_info contains the extra path information that… $fastcgi_script_name The $fastcgi_script_name variable contains the script name being processed by… $grpc_internal_trailers The variable $grpc_internal_trailers contains the internal trailer fields of a… $gzip_ratio The $gzip_ratio variable holds the compression ratio achieved by gzip when… Cacheable $host The $host variable in NGINX holds the host name from the HTTP request header… Cacheable $hostname The $hostname variable returns the hostname of the server as specified in the… Cacheable $http_* The variable $http_ holds the value of a specific HTTP header from the client… Cacheable $http_cookie The $http_cookie variable captures the value of the Cookie header from an… Cacheable $http_host The `$http_host` variable contains the value of the Host header sent by the… Cacheable $http_referer The $http_referer variable contains the value of the Referer HTTP header from… Cacheable $http_user_agent The $http_user_agent variable contains the value of the User-Agent HTTP… Cacheable $http_via The $http_via variable retrieves the value of the 'via' header sent by… Cacheable $http_x_forwarded_for The $http_x_forwarded_for variable contains the value of the X-Forwarded-For… Cacheable $https The $https variable indicates whether a request was made over HTTPS (secure)… Cacheable $invalid_referer The $invalid_referer variable is set to 1 if the request's referer is not… Cacheable $is_args The $is_args variable indicates whether the current request includes arguments… $is_request_port The $is_request_port variable indicates whether the request was made on an… Cacheable $limit_conn_status $limit_conn_status returns the status of connection limiting on a per-client… $limit_rate $limit_rate controls the maximum transfer rate for a response, effectively… $limit_req_status The $limit_req_status variable outputs the status code of the request limiting… $msec The $msec variable contains the current time in milliseconds since the epoch. $nginx_version The variable $nginx_version holds the version number of the currently running… Cacheable $pid The $pid variable returns the process ID (PID) of the NGINX worker process… Cacheable $pipe The $pipe variable indicates whether the request is being processed in a… Cacheable $proxy_add_via The $proxy_add_via variable is used to append a 'Via' header to HTTP requests… Cacheable $proxy_add_x_forwarded_for The $proxy_add_x_forwarded_for variable appends the client's IP address to the… Cacheable $proxy_host The variable $proxy_host contains the hostname of the upstream server being… $proxy_internal_body_length $proxy_internal_body_length returns the length of the request body received… $proxy_internal_chunked $proxy_internal_chunked indicates whether internal responses should be sent in… $proxy_internal_connection $proxy_internal_connection indicates whether the connection to a proxied… $proxy_internal_host $proxy_internal_host returns the hostname of the internal proxy for a request. $proxy_port The $proxy_port variable returns the port number of the proxied server. $proxy_protocol_addr $proxy_protocol_addr returns the client address from the PROXY protocol, if… Cacheable $proxy_protocol_port The $proxy_protocol_port variable returns the port number from which a proxied… Cacheable $proxy_protocol_server_addr $proxy_protocol_server_addr returns the IP address of the client as sent by… Cacheable $proxy_protocol_server_port The $proxy_protocol_server_port variable returns the server port as specified… Cacheable $proxy_protocol_tlv_* The $proxy_protocol_tlv_ variables provide access to information contained in… Cacheable $query_string The $query_string variable contains the query string part of the client's… $realip_remote_addr The variable $realip_remote_addr contains the original client IP address when… Cacheable $realip_remote_port The variable $realip_remote_port holds the port number of the client making… Cacheable $realpath_root The $realpath_root variable returns the canonical filename of the root… $remote_addr The $remote_addr variable holds the IP address of the client making the… Cacheable $remote_port The $remote_port variable in NGINX contains the port number of the client… Cacheable $remote_user The $remote_user variable contains the username supplied by the client during… Cacheable $request The $request variable contains the full request line received from the client… Cacheable $request_body The $request_body variable contains the raw body of the client request. Cacheable $request_body_file The $request_body_file variable contains the path to a temporary file holding… Cacheable $request_completion The variable $request_completion returns the status of the request processing… Cacheable $request_filename The $request_filename variable contains the full path to the file being… $request_id The $request_id variable contains a unique identifier for each request… Cacheable $request_length The variable $request_length returns the total size of the client request body… $request_method The $request_method variable in NGINX contains the HTTP method used for the… $request_port The $request_port variable contains the port number used by the client to send… Cacheable $request_time $request_time contains the total time taken to process the request, in seconds… $request_uri The $request_uri variable contains the original request URI as sent by the… Cacheable $scheme The $scheme variable in NGINX returns the protocol of the current request… Cacheable $secure_link The $secure_link variable is used to validate a secure link to a resource… Cacheable $secure_link_expires $secure_link_expires returns the expiration timestamp for a secure link in… Cacheable $sent_http_* The $sent_http_ prefix variable returns HTTP response headers sent to the… Cacheable $sent_http_cache_control $sent_http_cache_control contains the value of the 'Cache-Control' header sent… Cacheable $sent_http_connection The variable $sent_http_connection holds the value of the 'Connection' header… Cacheable $sent_http_content_length The $sent_http_content_length variable returns the value of the Content-Length… Cacheable $sent_http_content_type The $sent_http_content_type variable holds the Content-Type header sent in the… Cacheable $sent_http_keep_alive The $sent_http_keep_alive variable in NGINX contains the value of the… Cacheable $sent_http_last_modified The $sent_http_last_modified variable contains the Last-Modified header… Cacheable $sent_http_link The $sent_http_link variable contains the value of the Link HTTP response… Cacheable $sent_http_location The $sent_http_location variable contains the HTTP Location header sent in the… Cacheable $sent_http_transfer_encoding $sent_http_transfer_encoding contains the value of the 'Transfer-Encoding'… Cacheable $sent_trailer_* The $sent_trailer_ variable is a prefix variable used to retrieve trailers… Cacheable $server_addr The $server_addr variable returns the IP address of the server as specified in… Cacheable $server_name The $server_name variable represents the name of the virtual host serving the… Cacheable $server_port The $server_port variable returns the port number on which the current request… Cacheable $server_protocol The $server_protocol variable contains the protocol used for the current… Cacheable $ssl_alpn_protocol The variable $ssl_alpn_protocol contains the Application-Layer Protocol… Cacheable $ssl_cipher The $ssl_cipher variable contains the name of the cipher used for SSL/TLS… Cacheable $ssl_ciphers The $ssl_ciphers variable contains the list of SSL/TLS ciphers used for the… Cacheable $ssl_client_cert The variable $ssl_client_cert contains the client's SSL certificate as a PEM… Cacheable $ssl_client_escaped_cert The $ssl_client_escaped_cert variable contains the PEM-encoded and URL-escaped… Cacheable $ssl_client_fingerprint The variable $ssl_client_fingerprint represents the fingerprint of the… Cacheable $ssl_client_i_dn The $ssl_client_i_dn variable holds the Identity Distinguished Name (DN) of a… Cacheable $ssl_client_i_dn_legacy The $ssl_client_i_dn_legacy variable returns the legacy distinguished name… Cacheable $ssl_client_raw_cert The $ssl_client_raw_cert variable contains the raw bytes of the client's SSL… Cacheable $ssl_client_s_dn The $ssl_client_s_dn variable contains the subject distinguished name from the… Cacheable $ssl_client_s_dn_legacy The $ssl_client_s_dn_legacy variable contains the legacy subject distinguished… Cacheable $ssl_client_serial The $ssl_client_serial variable contains the serial number of the client SSL… Cacheable $ssl_client_sigalg The variable $ssl_client_sigalg contains the signature algorithm used by the… Cacheable $ssl_client_v_end The variable $ssl_client_v_end contains the end time of the client's SSL… Cacheable $ssl_client_v_remain $ssl_client_v_remain returns the remaining number of bytes in the SSL client's… Cacheable $ssl_client_v_start $ssl_client_v_start returns the timestamp when the SSL handshake is completed… Cacheable $ssl_client_verify $ssl_client_verify indicates the verification status of a client certificate… Cacheable $ssl_curve The $ssl_curve variable returns the name of the elliptic curve used for… Cacheable $ssl_curves The $ssl_curves variable returns the list of elliptic curves negotiated during… Cacheable $ssl_early_data The $ssl_early_data variable indicates whether early data has been received in… $ssl_ech_outer_server_name $ssl_ech_outer_server_name returns the outer server name used in the Encrypted… Cacheable $ssl_ech_status The $ssl_ech_status variable indicates the status of the Encrypted ClientHello… Cacheable $ssl_protocol $ssl_protocol contains the SSL/TLS protocol version used for a connection. Cacheable $ssl_server_name The variable $ssl_server_name contains the name of the server specified with… Cacheable $ssl_session_id The $ssl_session_id variable contains the unique identifier for the current… Cacheable $ssl_session_reused The $ssl_session_reused variable indicates whether an existing SSL session was… Cacheable $ssl_sigalg The $ssl_sigalg variable returns the signature algorithm used in the SSL… Cacheable $status The $status variable returns the HTTP response status code of the current… $tcpinfo_rcv_space The $tcpinfo_rcv_space variable returns the amount of memory allocated for the… $tcpinfo_rtt The $tcpinfo_rtt variable returns the round-trip time (RTT) of the TCP… $tcpinfo_rttvar The $tcpinfo_rttvar variable returns the round-trip time variation for TCP… $tcpinfo_snd_cwnd $tcpinfo_snd_cwnd returns the TCP send congestion window size in bytes. $time_iso8601 The variable $time_iso8601 returns the current time in ISO 8601 format. $time_local The $time_local variable returns the current local time in the format used by… $uid_got The $uid_got variable returns the user ID of the request's owner, which is… Cacheable $uid_reset The $uid_reset variable indicates whether the UID of a request should be reset… Cacheable $uid_set The $uid_set variable contains the user ID set for the current request context… Cacheable $uri The $uri variable in NGINX returns the URI part of a requested resource…

NGINX Core (Stream)3

NGINX CoolKit Module2

NGINX Module for Google Mirror creation4

An NGINX module for collecting stats into Graphite1

IP address anonymizer module for NGINX3

NGINX JWT Module4

Kaltura Media Framework Common NGINX Module15

NGINX module for handling file uploads16

Nginx stream server traffic status core module9

Secure token module for NGINX4

NGINX sysguard module10