FAQ

Page Discussion Edit History

ChsHttpSsiModule

Revision as of 19:22, 22 September 2010 by MichaelLustfield (Talk)

(diff) 鈫 Older revision | Latest revision (diff) | Newer revision 鈫 (diff)

Contents

[edit] ngx_http_ssi_module

姝ゆā鍧楀鐞嗘湇鍔″櫒绔寘鍚枃浠(ssi)鐨勫鐞. 鍒楄〃涓殑鍛戒护褰撳墠骞舵湭瀹屽叏鏀寔.

__閰嶇疆绀轰緥__

location / {
: ssi  on;
}

[edit] Directives

  • [#ssi ssi]
  • [#ssi_silent_errors ssi_silent_errors]
  • [#ssi_types ssi_types]
  • [#ssi_value_length ssi_value_length]


Template:Anchor

[edit] ssi

璇硶: ssi [ on | off ]

榛樿鍊: ssi off

浣滅敤鍩: http, server, location 鍦╨ocation浣滅敤鍩熶腑灏嗗惎鐢⊿SI鏂囦欢澶勭悊.

Template:Anchor

[edit] ssi_silent_errors

璇硶: ssi_silent_errors [on|off]

榛樿鍊: ssi_silent_errors off

浣滅敤鍩: http, server, location

鍦ㄥ鐞哠SI鏂囦欢鍑洪敊鏃朵笉杈撳嚭閿欒鎻愮ず:"[an error occurred while processing the directive] "

Template:Anchor

[edit] 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.

Template:Anchor

[edit] ssi_value_length

璇硶: ssi_value_length length

榛樿鍊: ssi_value_length 256

浣滅敤鍩: http, server, location

瀹氫箟SSI鍏佽浣跨敤鐨勫弬鏁伴暱搴

[edit] SSI 鍛戒护

鏍煎紡绀轰緥濡備笅:

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

鏀寔鐨凷SI 鍛戒护濡備笅:

  • block 鈥 command describes the block, which can be used as a silencer in command include. Inside the block there can be commands SSI.
  • name 鈥 the name of the block. For example:
: <!--# block name="one" --> : the silencer : <!--# endblock --> :
  • config 鈥 assigns some parameters with working SSI.
  • errmsg 鈥 the line, which is derived with the error during the SSI processing. By default, this string is used: "[an error occurred while processing the directive] "
  • timefmt 鈥 the time formatting string, as used in strftime(3). By default, this string is used:
: "%A, %d-%b-%Y %H:%M:%S %Z" : To include time in seconds use the format "%s" as well.
  • echo - print a variable
  • var 鈥 the name of the variable
  • default - if the variable is empty, display this string. Defaults to "none". Example:
: <!--# echo var="name" default="no" --> : </code> is the same as <code> : <!--# if expr="$name" --><!--# echo var="name" --><!--# else -->no<!--# endif --> :
  • if/elif/else/endif 鈥 conditionally include text or other directives. Usage:
...
...
...
</pre> Only one level of nesting is possible.
  • expr 鈥 the expression to evaluate. It can be a variable:
<!--# 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 胁褋褌褉械褔邪褞褌褋褟 锌械褉械屑械薪薪褘械, 褌芯 锌褉芯懈蟹胁芯写懈褌褋褟 锌芯写褋褌邪薪芯胁泻邪 懈褏 蟹薪邪褔械薪懈泄.
  • <code>include 鈥 include a document from another source.
  • file 鈥 include a file, e.g.
: <!--# include file="footer.html" --> :
  • virtual 鈥 include a request, e.g.
<!--# include virtual="/remote/body.php?argument=value" -->
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.
<!--# block name="one" --> <!--# endblock -->
<!--# include virtual="/remote/body.php?argument=value" stub="one" -->
  • wait 鈥 when set to yes, the rest of the SSI will not be evaluated until the current request is finished. Example:
<!--# include virtual="/remote/body.php?argument=value" wait="yes" -->
  • set - assign a variable.
  • var 鈥 the variable.
  • value 鈥 its value. If it contains variable names, these will be evaluated.

[edit] 鍐呯疆鍙橀噺

ngx_http_ssi_module 鏀寔涓ょ鍐呯疆鍙橀噺:

  • $date_local - 褰撳墠鐨勬湰鍦版椂鍖烘椂闂.閰嶇疆閫夐」"timefmt"鎺у埗鏍煎紡.
  • $date_gmt - 褰撳墠鐨凣MT鏃堕棿. 閰嶇疆閫夐」"timefmt"鎺у埗鏍煎紡.


[edit] 鍙傝

Original Documentation