Skip to main content

Variable - Nginx

These expressions are equivalent

$uri
"$uri"
${uri}
"${uri}"

Var Index

VariableAliasDescription
$uri$document_uriURI, exclude $args, change when internal redirect / using index
$args$query_stringquery string (the string after ? in URI)
$document_rootroot or alias value
$host$host
$http_hostHost request header field
$request_uri$requestfull original request URI (with $args)
$remote_addrclient IP address
$remote_portclient port

$host

In this order of precedence (from high to low)

  • Host name from the request line
  • Host request header field
  • The server name matching a request

Validation