Predefined variables
NGINX makes constructing configurations based on the values of variables easy. Not only can you instantiate your own variables by using the set
or map
directives, but there are also predefined variables used within NGINX. They are optimized for quick evaluation and the values are cached for the lifetime of a request. You can use any of them as a key in an if
statement, or pass them on to a proxy. A number of them may prove useful if you define your own log file format. If you try to redefine any of them, though, you will get an error message, as follows:
<timestamp> [emerg] <master pid>#0: the duplicate "<variable_name>" variable in <path-to-configuration-file>:<line-number>
They are also not made for macro expansion in the configuration—they are mostly used at runtime.
The following table lists the variables and their values defined in the http
module:
HTTP variable names |
Value |
---|---|
|
This variable specifies the |