nginx ssi 模块

在nginx下与SSI配置相关的参数主要有ssi  ssi_sclient_error ssi_types三个。具体的用法如下

ssi on
开启ssi支持,默认是off
ssi_silent_errors on
默认值是off,开启后在处理SSI文件出错时不输出错误提示:"[an error occurred while processing the directive] "
ssi_types
默认是ssi_types text/html,所以如果需要htm和html支持,则不需要设置这句,如果需要shtml支持,则需要设置:ssi_types text/shtml

SSI引用的格式如下:

SSI的格式:
<!--#include file="foot.html"--><!--#include virtual="/tx/foot.html"-->
路径是相对server中root根目录。站点的绝对路径

例如一个index.html页面里有下面一段

<div class="footer">
 <div class="footer_bottom">版权所有 @2011 运维之路www.361way.com 浙ICP备XXXX号</div>
  <div class="footer_bottom" >声明:本站…………………… </div>
</div>

我可以保存为foot.html或者foot.shtml,在index.html引入即可

前提reload下ssi使其生效

原文地址:https://www.cnblogs.com/wangjiafang/p/4422118.html