FAQ

Page Discussion Edit History

RuHttpSsiModule

(Redirected from NginxRuHttpSsiModule)

Contents

[edit] ngx_http_ssi_module

袦芯写褍谢褜 ngx_http_ssi_module 鈥 褎懈谢褜褌褉, 芯斜褉邪斜邪褌褘胁邪褞褖懈泄 泻芯屑邪薪写褘 SSI (Server Side Includes) 胁 锌褉芯褏芯写褟褖懈褏 褔械褉械蟹 薪械谐芯 芯褌胁械褌邪褏. 袧邪 写邪薪薪褘泄 屑芯屑械薪褌 褋锌懈褋芯泻 锌芯写写械褉卸懈胁邪械屑褘褏 泻芯屑邪薪写 SSI 薪械锌芯谢芯薪. 小芯写械褉卸邪薪懈械 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈 袛懈褉械泻褌懈胁褘


袣芯屑邪薪写褘 SSI 袙褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈

location / {
: ssi  on;
}

[edit] 袛懈褉械泻褌懈胁褘

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


Template:Anchor

[edit] ssi

syntax: ssi [on|off]

default: ssi off

context: http, server, location, if 胁 location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 芯斜褉邪斜芯褌泻褍 泻芯屑邪薪写 SSI 胁 芯褌胁械褌邪褏.

Template:Anchor

[edit] ssi_silent_errors

syntax: ssi_silent_errors [on|off]

default: ssi_silent_errors off

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 薪械 胁褘胁芯写懈褌褜 褋褌褉芯泻褍 "[an error occurred while processing the directive] ", 械褋谢懈 胁芯 胁褉械屑褟 芯斜褉邪斜芯褌泻懈 SSI 锌褉芯懈蟹芯褕谢邪 芯褕懈斜泻邪.

Template:Anchor

[edit] ssi_types

syntax: ssi_types mime-褌懈锌 [mime-褌懈锌 ...]

default: ssi_types text/html

context: http, server, location

袪邪蟹褉械褕邪械褌 芯斜褉邪斜芯褌泻褍 泻芯屑邪薪写 SSI 胁 芯褌胁械褌邪褏 褋 褍泻邪蟹邪薪薪褘屑懈 MIME-褌懈锌邪屑懈 胁 写芯锌芯谢薪械薪懈械 泻 "text/html". 袣芯屑邪薪写褘 SSI

肖芯褉屑邪褌 泻芯屑邪薪写褘 褋谢械写褍褞褖懈泄

: <!--# 泻芯屑邪薪写邪 锌邪褉邪屑械褌褉1=蟹薪邪褔械薪懈械 锌邪褉邪屑械褌褉2=蟹薪邪褔械薪懈械 ... -->

袧懈卸械 锌械褉械褔懈褋谢械薪褘 锌芯写写械褉卸懈胁邪械屑褘械 泻芯屑邪薪写褘:

  • block 鈥 泻芯屑邪薪写邪 芯锌懈褋褘胁邪械褌 斜谢芯泻, 泻芯褌芯褉褘泄 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 泻邪泻 蟹邪谐谢褍褕泻褍 胁 泻芯屑邪薪写械 include. 袙薪褍褌褉懈 斜谢芯泻邪 屑芯谐褍褌 斜褘褌褜 泻芯屑邪薪写褘 SSI.
  • name 鈥 懈屑褟 斜谢芯泻邪. 袩褉懈屑械褉 懈褋锌芯谢褜蟹芯胁邪薪懈褟:
: <!--# block name="one" --> : 蟹邪谐谢褍褕泻邪 : <!--# endblock --> :
  • config 鈥 泻芯屑邪薪写邪 蟹邪写邪褢褌 薪械泻芯褌芯褉褘械 锌邪褉邪屑械褌褉褘 锌褉懈 芯斜褉邪斜芯褌泻械 SSI.
  • errmsg 鈥 褋褌褉芯泻邪, 胁褘胁芯写褟褖邪褟褋褟 锌褉懈 芯褕懈斜泻械 胁芯 胁褉械屑褟 芯斜褉邪斜芯褌泻懈 SSI. 袩芯 褍屑芯谢褔邪薪懈褞 懈褋锌芯谢褜蟹褍械褌褋褟 褌邪泻邪褟 褋褌褉芯泻邪: "[an error occurred while processing the directive] "
  • timefmt 鈥 褋褌褉芯泻邪, 懈褋锌芯谢褜蟹褍械屑邪褟 褎褍薪泻褑懈械泄 strftime(3) 写谢褟 胁褘胁芯写邪 写邪褌 懈 胁褉械屑械薪懈. 袩芯 褍屑芯谢褔邪薪懈褞 懈褋锌芯谢褜蟹褍械褌褋褟 褌邪泻芯泄 褎芯褉屑邪褌:
: "%A, %d-%b-%Y %H:%M:%S %Z" : 袛谢褟 胁褘胁芯写邪 胁褉械屑械薪懈 胁 褋械泻褍薪写邪褏 锌芯写褏芯写懈褌 褎芯褉屑邪褌 "%s".
  • echo 鈥 泻芯屑邪薪写邪 胁褘胁芯写懈褌 蟹薪邪褔械薪懈械 锌械褉械屑械薪薪芯泄.
  • var 鈥 懈屑褟 锌械褉械屑械薪薪芯泄.
  • default 鈥 薪械褋褌邪薪写邪褉褌薪褘泄 锌邪褉邪屑械褌褉, 蟹邪写邪褞褖懈泄 褋褌褉芯泻褍, 泻芯褌芯褉邪褟 胁褘胁芯写懈褌褋褟, 械褋谢懈 锌械褉械屑械薪薪邪褟 薪械 芯锌械褉械写械谢械薪邪. 袩芯 褍屑芯谢褔邪薪懈褞 胁褘胁芯写懈褌褋褟 褋褌褉芯泻邪 "none". 袣芯屑邪薪写邪
: <!--# echo var="name" default="薪械褌" --> : </code> 蟹邪屑械薪褟械褌 褌邪泻褍褞 锌芯褋谢械写芯胁邪褌械谢褜薪芯褋褌褜 泻芯屑邪薪写 <code> : <!--# if expr="$name" --><!--# echo var="name" --><!--# else -->薪械褌<!--# endif --> :
  • if 鈥 泻芯屑邪薪写邪 胁褘锌芯谢薪褟械褌 褍褋谢芯胁薪芯械 胁泻谢褞褔械薪懈械. 袩芯写写械褉卸懈胁邪褞褌褋褟 褋谢械写褍褞褖懈械 泻芯屑邪薪写褘:
<!--# if expr="..." -->
...
<!--# elif expr="..." -->
...
<!--# else -->
...
<!--# endif -->
袧邪 写邪薪薪褘泄 屑芯屑械薪褌 锌芯写写械褉卸懈胁邪褞褌褋褟 褌芯谢褜泻芯 芯写懈薪 褍褉芯胁械薪褜 胁谢芯卸械薪薪芯褋褌懈.
  • expr 鈥 胁褘褉邪卸械薪懈械. 袙 胁褘褉邪卸械薪懈懈 屑芯卸械褌 斜褘褌褜 锌褉芯胁械褉泻邪 褋褍褖械褋褌胁芯胁邪薪懈褟 锌械褉械屑械薪薪芯泄:
<!--# if expr="$name" -->
</code> 褋褉邪胁薪械薪懈械 锌械褉械屑械薪薪芯泄 褋 褌械泻褋褌芯屑: <code>
<!--# if expr="$name = text" -->
<!--# if expr="$name != text" -->
</code> 懈谢懈 褋 褉械谐褍谢褟褉薪褘屑 胁褘褉邪卸械薪懈械屑: <code>
<!--# if expr="$name = /text/" -->
<!--# if expr="$name != /text/" -->
袝褋谢懈 胁 text 胁褋褌褉械褔邪褞褌褋褟 锌械褉械屑械薪薪褘械, 褌芯 锌褉芯懈蟹胁芯写懈褌褋褟 锌芯写褋褌邪薪芯胁泻邪 懈褏 蟹薪邪褔械薪懈泄.
  • include 鈥 泻芯屑邪薪写邪 胁泻谢褞褔邪械褌 胁 芯褌胁械褌 褉械蟹褍谢褜褌邪褌 写褉褍谐芯谐芯 蟹邪锌褉芯褋邪.
  • file 鈥 蟹邪写邪褢褌 胁泻谢褞褔邪械屑褘泄 褎邪泄谢, 薪邪锌褉懈屑械褉:
: <!--# include file="footer.html" --> :
  • virtual 鈥 蟹邪写邪褢褌 胁泻谢褞褔邪械屑褘泄 蟹邪锌褉芯褋, 薪邪锌褉懈屑械褉:
<!--# include virtual="/remote/body.php?argument=value" -->
袧械褋泻芯谢褜泻芯 蟹邪锌褉芯褋芯胁 薪邪 芯写薪芯泄 褋褌褉邪薪懈褑械, 芯斜褉邪斜邪褌褘胁邪械屑褘械 褔械褉械蟹 锌褉芯泻褋懈 懈谢懈 FastCGI, 褉邪斜芯褌邪褞褌 锌邪褉邪谢谢械谢褜薪芯. 袝褋谢懈 薪褍卸薪芯 锌芯褋谢械写芯胁邪褌械谢褜薪邪褟 芯斜褉邪斜芯褌泻邪, 褌芯 薪褍卸薪芯 胁芯褋锌芯谢褜蟹芯胁邪褌褜褋褟 锌邪褉邪屑械褌褉芯屑 wait.
  • stub 鈥 薪械褋褌邪薪写邪褉褌薪褘泄 锌邪褉邪屑械褌褉, 蟹邪写邪褞褖懈泄 懈屑褟 斜谢芯泻邪, 褋芯写械褉卸懈屑芯械 泻芯褌芯褉芯谐芯 斜褍写械褌 胁褘胁械写械薪芯, 械褋谢懈 胁 褌械谢芯 芯褌胁械褌邪 薪邪 蟹邪锌褉芯褋 锌褍褋褌芯械 懈谢懈 锌褉懈 械谐芯 懈褋锌芯谢薪械薪懈懈 锌褉芯懈蟹芯褕谢邪 芯褕懈斜泻邪, 薪邪锌褉懈屑械褉:
<!--# block name="one" --> <!--# endblock -->
<!--# include virtual="/remote/body.php?argument=value" stub="one" -->
  • wait 鈥 薪械褋褌邪薪写邪褉褌薪褘泄 锌邪褉邪屑械褌褉, 褍泻邪蟹褘胁邪褞褖懈泄, 薪褍卸薪芯 谢懈 卸写邪褌褜 锌芯谢薪芯谐芯 懈褋锌芯谢薪械薪懈褟 写邪薪薪芯谐芯 蟹邪锌褉芯褋邪, 锌褉械卸写械 褔械屑 锌褉芯写芯谢卸邪褌褜 胁褘锌芯谢薪械薪懈械 SSI, 薪邪锌褉懈屑械褉:
<!--# include virtual="/remote/body.php?argument=value" wait="yes" -->
  • set 鈥 泻芯屑邪薪写邪 锌褉懈褋胁邪懈胁邪械褌 蟹薪邪褔械薪懈械 锌械褉械屑械薪薪芯泄.
  • var 鈥 懈屑褟 锌械褉械屑械薪薪芯泄.
  • value 鈥 蟹薪邪褔械薪懈械 锌械褉械屑械薪薪芯泄. 袝褋谢懈 胁 锌褉懈褋胁邪懈胁邪械屑芯屑 蟹薪邪褔械薪懈懈 械褋褌褜 懈屑械薪邪 锌械褉械屑械薪薪褘械, 褌芯 锌褉芯懈蟹胁芯写懈褌褋褟 锌芯写褋褌邪薪芯胁泻邪 懈褏 蟹薪邪褔械薪懈泄.

Template:Anchor

[edit] ssi_value_length

syntax: ssi_value_length 褉邪蟹屑械褉

default: ssi_value_length 256b

context: http, server, location

袛械褉械泻褌懈胁邪 蟹邪写邪褢褌 褉邪蟹屑械褉 ssi 锌械褉械屑械薪薪芯泄, 锌芯-褍屑芯谢褔邪薪懈褞 255 褋懈屑胁芯谢芯胁.

袙褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械

袦芯写褍谢褜 ngx_http_ssi_module 锌芯写写械褉卸懈胁邪械褌 写胁械 胁褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械:

  • $date_local, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褌械泻褍褖械屑褍 胁褉械屑械薪懈 胁 谢芯泻邪谢褜薪芯泄 胁褉械屑械薪薪芯泄 蟹芯薪械. 肖芯褉屑邪褌 写邪褌褘 蟹邪写邪褢褌褋褟 泻芯屑邪薪写芯泄 config 褋 锌邪褉邪屑械褌褉芯屑 timefmt.
  • $date_gmt, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褌械泻褍褖械屑褍 胁褉械屑械薪懈 胁 GMT. 肖芯褉屑邪褌 写邪褌褘 蟹邪写邪褢褌褋褟 泻芯屑邪薪写芯泄 config 褋 锌邪褉邪屑械褌褉芯屑 timefmt.


[edit] References

Original Documentation