Help Center

Tomcat : WebServer

Brief

Tomcat can handle high number of incoming requests, efficiently using a combination of load balancing multiple server “workers” to process the balanced load.


Installation

Setup and Configuration


  1. Download Apache Tomcat (/opt/cs/tomcat).


  1. Alternatively, visit https://tomcat.apache.org/download-90.cgi and download Version 9.

  1. Extract tar.gz.

    cd /opt/cs/tomcat
    
    tar -zxvf apache-tomcat-9.0.0.M9.tar.gz
    

  1. Change configuration:

    • You will find a block of code for Connector port. Replace that code with the one mentioned below:

      vim /opt/cs/tomcat/apache-tomcat-9.0.0.M9/conf/server.xml

      <Connector port="8080" maxHttpHeaderSize="8192"
      maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
      enableLookups="false" redirectPort="8443" acceptCount="100"
      connectionTimeout="20000" disableUploadTimeout="true"
      compression="on"
      compressionMinSize="2048"
      noCompressionUserAgents="gozilla, traviata"
      compressableMimeType="text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml,application/x-javascript,application/json"/>
      
    • Also add IP. You will find this at the end of the file.

    • Create a file bin/setenv.sh and specify the memory configuration.

      touch /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/setenv.sh
      vim  /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/setenv.sh  and add the following line:
      export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms4216m -Xmx13312m"
      

  1. Start up the application.

    Stop Tomcat
        /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/shutdown.shORfuser -k 8080/tcp
    
    Note: fuser is used just to kill the process if it is  running even after using 'shutdown.sh'.
    
    Start Tomcat
        cd  /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/
    
        ./startup.sh
    


  1. Remove/Add war.

    Remove war
      cd /opt/cs/tomcat/apache-tomcat-9.0.0.M9/webapps/
      rm edeka.war
      rm -r edeka
    
    Add war
      cp <Path of CS-Refactored>/CS-Refactored/REST/build/libs/edeka.war /opt/cs/tomcat/apache-tomcat-9.0.0.M9/webapps/
    

Note: Before copying edeka.war to webapps directory of tomcat, make sure you have built the war.


Contentserv line

Last updated: Jul 27, 2018