Thursday, October 8, 2009

How to enable SSI in TOMCAT

To enable SSI in TOMCAT do the following:-
  1. Copy manager.xml or host-manager.xml from within C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost and paste it in the same folder. Now rename it to MYAPPLICATION.xml MYAPPLICATION should be exaclty same as the application folder name and it should be put inside webapps folder.
    Essentially you want to create an application xml with Context having privileged="true".

  2. opy manager.xml or host-manager.xml from within C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost and paste it in the same folder. Now rename it to ROOT.xml. If you don't do this step you will not be able to view/load the default TOMCAT page by using the URL http://localhost:8080/

  3. Open web.xml from C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf and remove the XML comments from around the following:-

    <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>
    <load-on-startup>4</load-on-startup>
    </servlet>

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

  4. Change the file extension which has the include statement to the appropiate extension as per in the line

    <url-pattern>*.shtml</url-pattern>

    You can change it to any extension you want, provided you make tha same change in url-pattern above.

1 comment:

  1. I agree with you, however if I set a url-protected directory all the files
    in that url-protected directory must be under Tomcat, and thus if some of
    the files are shtm's and use SSI, the headers and footers will no longer
    show up because the page is now being server up by Tomcat rather than IIS.
    When protecting a a directory via in web.xml it is my
    understanding that anything with that url pattern is served up by Tomcat
    regadless of the file type.

    zubehör

    ReplyDelete