页面中用法:
<!--#include virtual="/include/topBar.html"-->
resin:
web.xml
<servlet>
<servlet-name>SSIServlet</servlet-name>
<servlet-class>
com.caucho.servlets.ssi.SSIServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SSIServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
nginx:
nginx.conf
server {
listen 80;
server_name www.17guagua.com 17guagua.com www.17guagua.net 17guagua.net;
charset gbk;
ssi on;
ssi_silent_errors on;
error_page 502 http://www.XXX.com/502.html;
error_page 504 http://www.XXX.com/504.html;
error_page 404 http://www.XXX.com/404.html;
location ~* \.(shtml)$
{
rewrite ^/(.*)\.shtml$ http://$host/$1.html break;
}...
}
tomcat:
web.xml:
<servlet>
<servlet-name>ssi</servlet-name>
<servlet-class>
org.apache.catalina.ssi.SSIServlet
</servlet-class>
<init-param>
<init-param><param-name>buffered</param-name><param-value>1</param-value></init-param>
<init-param><param-name>debug</param-name><param-value>0</param-value></init-param>
<init-param><param-name>expires</param-name><param-value>666</param-value></init-param>
<init-param><param-name>isVirtualWebappRelative</param-name><param-value>0</param-value></init-param>
<init-param><param-name>inputEncoding</param-name><param-value>utf-8</param-value></init-param>
<init-param><param-name>outputEncoding</param-name><param-value>utf-8</param-value></init-param>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
Tomcat 5需要将$CATALINA_HOME/server/lib下的servlets-ssi.renametojar文件改名成servlets- ssi.jar
Tomcat 6需要将$CATALINA_HOME/conf/context.xml中 结点添加一个属性 privileged="true"
来源:oschina
链接:https://my.oschina.net/u/195615/blog/110571