nginx,resin,tomcat中的SSI配置

送分小仙女□ 提交于 2019-12-05 11:04:46

 

页面中用法:
<!--#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=&quot;true&quot;

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!