Nginx中文文档

HttpSSI模块

此模块处理服务器端包含文件(ssi)的处理. 列表中的命令当前并未完全支持.

__配置示例__


location / {
: ssi  on;
}

Directives


ssi

语法: ssi [ on | off ]

默认值: ssi off

作用域: http, server, location 在location作用域中将启用SSI文件处理.

ssi_silent_errors

语法: ssi_silent_errors [on|off]

默认值: ssi_silent_errors off

作用域: http, server, location

在处理SSI文件出错时不输出错误提示:"[an error occurred while processing the directive] "

ssi_types

语法: 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

语法: ssi_value_length length

默认值: ssi_value_length 256

作用域: http, server, location

定义SSI允许使用的参数长度

SSI 命令

格式示例如下:

: <!--#  command parameter1=value parameter2=value... -->

支持的SSI 命令如下:

: <!--# block name="one" --> : the silencer : <!--# endblock --> : : "%A, %d-%b-%Y %H:%M:%S %Z" : To include time in seconds use the format "%s" as well. : <!--# echo var="name" default="no" --> : </code> is the same as <code> : <!--# if expr="$name" --><!--# echo var="name" --><!--# else -->no<!--# endif --> :
...
...
...
Only one level of nesting is possible.
<!--# if expr="$name" -->
</code> A string comparison: <code>
<!--# if expr="$name = text" -->
<!--# if expr="$name != text" -->
</code> Or a regex match: <code>
<!--# if expr="$name = /text/" -->
<!--# if expr="$name != /text/" -->
Если в text встречаются переменные, то производится подстановка их значений.
: <!--# include file="footer.html" --> :
<!--# include virtual="/remote/body.php?argument=value" -->
Multiple requests will be issued in parallel. If you need them issued sequentially, use the "wait" option.
<!--# block name="one" --> <!--# endblock -->
<!--# include virtual="/remote/body.php?argument=value" stub="one" -->
<!--# include virtual="/remote/body.php?argument=value" wait="yes" -->

内置变量

ngx_http_ssi_module 支持两种内置变量:


参考

Original Documentation