Configure Tomcat SSI shtml

Source: Internet
Author: User

First, it is unwise for Tomcat to parse ssi. It is best to let Tomcat integrate Apache and let Apache parse static files.

The configuration process is as follows:

Currently, mainstream Web servers provide SSI implementation. You only need to enable the SSI function.
Next we will introduce how to use SSI Technology in tomcat5.5:
Step 1: Change the name of $ catalina_home/Server/lib/servlets-ssi.renametojar to servlets-ssi.jar
Step 2: Set $ catalina_home/CONF/context. add the privileged = "true" attribute to the <context> node. This attribute specifies that the published web application has the permission to use the servlet of the container. If you want to add other web applications to $ catalina_home/CONF/server. XML, you 'd better add the privileged = "true" attribute to <context> as follows:
<Context DEBUG = "0" Path = "" docbase = "E:/Website" privileged = "true"/>
Step 3: Enable SSI in $ catalina_home/CONF/Web. xml. Tomcat provides two methods to enable SSI: Servlet and filter. Here, we use servlet to enable the SSI function.
In $ catalina_home/CONF/web. find <servlet-Name> SSI </servlet-Name> in the XML file, remove the comments to the servlet, and specify the inputencoding and outputencoding attribute values according to the shtml file encoding format,CodeSee the next page.

If it is tomcat6, the first step can be omitted

<Servlet>
<Servlet-Name> SSI </servlet-Name>
<Servlet-class> org. Apache. Catalina. ssi. SSIServlet </servlet-class>
Some code is omitted here
<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>
After opening the servlet comment above, we should not forget to remove the comment of <servlet-mapping>, for example:
<Servlet-mapping>
<Servlet-Name> SSI </servlet-Name>
<URL-pattern> *. shtml </url-pattern>
</Servlet-mapping>

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.