此模块处理服务器端包含文件(ssi)的处理. 列表中的命令当前并未完全支持.
配置示例
location / {
: ssi on;
}
语法:*ssi [ on | off ]*
默认值:*ssi off*
作用域:*http, server, location* 在location作用域中将启用SSI文件处理.
语法:*ssi_silent_errors [on|off]*
默认值:*ssi_silent_errors off*
作用域:*http, server, location*
在处理SSI文件出错时不输出错误提示:"[an error occurred while processing the directive] "
语法:*ssi_types mime-type [mime-type ...]*
默认值:*ssi_types text/html*
作用域:*http, server, location*
Enables SSI processing for MIME-types in addition to "text/html" types.
语法:*ssi_value_length length*
默认值:*ssi_value_length 256*
作用域:*http, server, location*
定义SSI允许使用的参数长度
格式示例如下:
:
支持的SSI 命令如下:
block
— command describes the block, which can be used as a silencer in command include
. Inside the block there can be commands SSI
.
: : the silencer : :
config
— assigns some parameters with working SSI.
: "%A, %d-%b-%Y %H:%M:%S %Z" : To include time in seconds use the format "%s" as well.
echo
- print a variable
: : is the same as : no :
if / elif / else / endif
— conditionally include text or other directives. Usage:
.........Only one level of nesting is possible.
A string comparison:
Or a regex match:
Если в text встречаются переменные, то производится подстановка их значений. -
include — include a document from another source. - *file* — include a file, e.g.
: :
- *virtual* — include a request, e.g.
Multiple requests will be issued in parallel. If you need them issued sequentially, use the "wait" option.
- *stub* — The name of the block to use as a default if the request is empty or returns an error.
- *wait* — when set to yes, the rest of the SSI will not be evaluated until the current request is finished. Example:
~~~
-
set
- assign a variable.
-
var — the variable.
-
value — its value. If it contains variable names, these will be evaluated.
内置变量
ngx_http_ssi_module 支持两种内置变量:
-
$date_local
- 当前的本地时区时间.配置选项"timefmt"控制格式.
-
$date_gmt
- 当前的GMT时间. 配置选项"timefmt"控制格式.
参考