tomcat开启与配置ssi

tomcat开启与配置ssi

转载地址:http://www.iitshare.com/tomcat-open-and-configure-ssi.html

修改web.xml文件
本文已apache-tomcat-6.0.29为讲解示例,其他版本的tomcat配置与之相同
1、打开apache-tomcat-6.0.29confweb.xml 配置文件
2、去掉文件298行左右关于ssi配置的注释,具体去掉注释的代码如下:

<servlet>
    <servlet-name>ssi</servlet-name>
    <servlet-class>
      org.apache.catalina.ssi.SSIServlet
    </servlet-class>
    <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>GBK</param-value>
    </init-param>
    <init-param>
      <param-name>outputEncoding</param-name>
      <param-value>GBK</param-value>
    </init-param>
    <load-on-startup>4</load-on-startup>
</servlet>

其中以下代码为可选项,可以在以上模块中不加入:

<init-param>
  <param-name>inputEncoding</param-name>
  <param-value>GBK</param-value>
</init-param>
<init-param>
  <param-name>outputEncoding</param-name>
  <param-value>GBK</param-value>
</init-param>

3、去掉文件405行左右关于ssi配置的注释,具体去掉注释的代码如

<servlet-mapping>
    <servlet-name>ssi</servlet-name>
    <url-pattern>*.shtml</url-pattern>
</servlet-mapping>

如果要对html文件也执行SSI代码则添加下列mapping

<servlet-mapping>
    <servlet-name>ssi</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>

4、关于web.xml475行左右的filter不用开启
修改context.xml文件
1、打开apache-tomcat-6.0.29confcontext.xml配置文件
2、在文件19行Context节点中加入privileged=”true” 加入完之后的配置如下:

<Context privileged="true">
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
</Context>
IT文库 » tomcat开启与配置ssi
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址