The method to install the Tomcat server and configure the virtual directory under the Windows system

  • 2020-05-14 05:39:51
  • OfStack

Install Tomcat and configure the environment variables
Install jdk, which I won't have to say
When installing, specify the installation path, I specify: D:\Program Files\Java\ jdk1.6.0_05
3. Unzip the apache-tomcat-5.5.23. zip,
I specify D:\Program Files\ apache-tomcat-5.5.26

When the installation is complete, open "my computer "- > "System properties "- > "Environment variables" in "user variables"

The new "CATALINA_HOME"
The variable value is: D:\Program Files\ apache-tomcat-5.5.26

The new "JAVA_HOME"
The variable value is: D:\Program Files\Java\ jdk1.6.0_05

The new "PATH"
The value of the variable is: JAVA_HOME%\bin

The directories under tomacat are in order :bin,common,conf, and so on.
Put the jsp file under D:\Program Files\ apache-tomcat-5.5.26 \webapps\ROOT.
Execute D:\Program Files\ apache-tomcat-5.5.26 \bin\ startup.bat to start tomcat
Execute D:\Program Files\ apache-tomcat-5.5.26 \bin\ shutdown.bat close tomcat

Configure virtual directories
Configuration method:
1. Modify port: modify Tomcat 5.5\ server.xml file port = "8080" instead of port = "80"
2. Create virtual directory: the virtual directory must contain: WEB-INF folder and web.xml file, web.xml must be in the WEB-INF folder (you can copy web.xml from Tomcat 5.5\webapps\ROOT\ WEB-INF)

3. Modify the contents of the copy of web.xml:


   <!-- JSPC servlet mappings start -->
        Delete the code in the middle 
   <!-- JSPC servlet mappings end -->

4. Modify the contents of Tomcat 5.5\ server.xml file in < HOST > < /HOST > Join between:


    <Context path="/web( Mapping name )" docBase="f:\web( Locally determined path )" reloadable="true" debug="0" />

5. Find in Tomcat 5.5\conf\ web.xml file:


     <servlet>

    <servlet-name>default</servlet-name>

    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>

    <init-param>

      <param-name>debug</param-name>

      <param-value>0</param-value>

    </init-param>

    <init-param>

      <param-name>listings</param-name>

      <param-value>false</param-value>  The default is :false  Instead of  true

    </init-param>

    <load-on-startup>1</load-on-startup>

  </servlet>


Related articles: