The ngx_http_ssi_module
module is a filter that processes SSI (Server Side Includes) commands in responses passing through it. Currently, the list of supported SSI commands is incomplete.
location / { ssi on; ... }
Syntax: | ssi |
---|---|
Default: | ssi off; |
Context: | http , server , location , if in location |
Enables or disables processing of SSI commands in responses.
Syntax: | ssi_last_modified |
---|---|
Default: | ssi_last_modified off; |
Context: | http , server , location |
This directive appeared in version 1.5.1.
Allows preserving the “Last-Modified” header field from the original response during SSI processing to facilitate response caching.
By default, the header field is removed as contents of the response are modified during processing and may contain dynamically generated elements or parts that are changed independently of the original response.
Syntax: | ssi_min_file_chunk |
---|---|
Default: | ssi_min_file_chunk 1k; |
Context: | http , server , location |
Sets the minimum size
for parts of a response stored on disk, starting from which it makes sense to send them using sendfile.
Syntax: | ssi_silent_errors |
---|---|
Default: | ssi_silent_errors off; |
Context: | http , server , location |
If enabled, suppresses the output of the “[an error occurred while processing the directive]
” string if an error occurred during SSI processing.
Syntax: | ssi_types |
---|---|
Default: | ssi_types text/html; |
Context: | http , server , location |
Enables processing of SSI commands in responses with the specified MIME types in addition to “text/html
”. The special value “*
” matches any MIME type (0.8.29).
Syntax: | ssi_value_length |
---|---|
Default: | ssi_value_length 256; |
Context: | http , server , location |
Sets the maximum length of parameter values in SSI commands.
SSI commands have the following generic format:
<!--# command parameter1=value1 parameter2=value2 ... -->
The following commands are supported:
block
include
command. The block can contain other SSI commands. The command has the following parameter: name
<!--# block name="one" --> stub <!--# endblock -->
config
errmsg
[an error occurred while processing the directive]
timefmt
strftime()
function used to output date and time. By default, the following format is used: "%A, %d-%b-%Y %H:%M:%S %Z"The “
%s
” format is suitable to output time in seconds. echo
var
encoding
none
, url
, and entity
. By default, entity
is used. default
(none)
” is output. The command <!--# echo var="name" default="no" -->replaces the following sequence of commands:
<!--# if expr="$name" --><!--# echo var="name" --><!--# else -->no<!--# endif -->
if
<!--# if expr="..." --> ... <!--# elif expr="..." --> ... <!--# else --> ... <!--# endif -->Only one level of nesting is currently supported. The command has the following parameter:
expr
<!--# if expr="$name" -->
<!--# if expr="$name =text
" --> <!--# if expr="$name !=text
" -->
<!--# if expr="$name = /text
/" --> <!--# if expr="$name != /text
/" -->
text
contains variables, their values are substituted. A regular expression can contain positional and named captures that can later be used through variables, for example: <!--# if expr="$name = /(.+)@(?P<domain>.+)/" --> <!--# echo var="1" --> <!--# echo var="domain" --> <!--# endif -->
include
file
<!--# include file="footer.html" -->
virtual
<!--# include virtual="/remote/body.php?argument=value" -->Several requests specified on one page and processed by proxied or FastCGI/uwsgi/SCGI servers run in parallel. If sequential processing is desired, the
wait
parameter should be used. stub
<!--# block name="one" --> <!--# endblock --> <!--# include virtual="/remote/body.php?argument=value" stub="one" -->The replacement block content is processed in the included request context.
wait
<!--# include virtual="/remote/body.php?argument=value" wait="yes" -->
set
<!--# include virtual="/remote/body.php?argument=value" set="one" -->It should be noted that only the results of responses obtained using the ngx_http_proxy_module, ngx_http_memcached_module, ngx_http_fastcgi_module (1.5.6), ngx_http_uwsgi_module (1.5.6), and ngx_http_scgi_module (1.5.6) modules can be written into variables.
set
var
value
The ngx_http_ssi_module
module supports two embedded variables:
$date_local
config
command with the timefmt
parameter. $date_gmt
config
command with the timefmt
parameter.
© 2002-2017 Igor Sysoev
© 2011-2017 Nginx, Inc.
Licensed under the BSD License.
https://nginx.org/en/docs/http/ngx_http_ssi_module.html