Deploying HTML, CSS webpage to Tomcat8

  1. Copy fonder /var/lib/tomcat8/webapps/ROOT to your folder.

    cp -r /var/lib/tomcat8/webapps/ROOT /var/lib/tomcat8/webapps/{yourfolder}

  2. add your htmls, css, js, in your folder.
  3. browser “http://localhost:8080/{yourfolder}”

Notes:

  1. if you using chrome web browser and did wrong folder before, then clean web browser’s cache(or change another name) otherwise (sometimes) it always 404.
  2. The folder META-INF with context.xml is needed.

Setup Tomcat 8 on Debian 8 on port 80

  1. Edit /etc/default/tomcat8.  At the very end, there should be a line that says AUTHBIND=no.  Change this to say AUTHBIND=yes
  2. Edit /etc/tomcat8/server.xml.  In this file, there is an XML tag that starts out with <Connector port=”8080″ ….  Change this to be 80.  There are two sections that you want to change this.
  3. Go to /etc/authbind/byport.  Do the following(note: this assumes that tomcat is running as the tomcat8 user, which it will do if you installed it through apt)
    $ cd /etc/authbind/byport
    $ touch 80
    $ chown tomcat8 80
    $ chmod 744 80
  4. Restart Tomcat   —  $ systemctl restart tomcat8
    You should now be able to access Tomcat on port 80.

Increase Memory Heap Size in Apache Tomcat

Option 1:

Open the catalina.sh script file under $CATALINA_HOME/bin/catalina.sh directory assign it,

export CATALINA_OPTS="-Xms128M -Xmx512M"

 

or simply export,

export CATALINA_OPTS=”-Xms128M -Xmx512MB”

 

The heap size has been set to Minumum 128MB and maximum 512MB

Option 2:

$CATALINA_HOME/bin/setenv.sh

Another option is create a setenv.sh file and add below line,

export CATALINA_OPTS=”${CATALINA_OPTS} -Djava.awt.headless=true -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Xms128m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=950m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled”

 

export CATALINA_OPTS="-Xms128M -Xmx512MB"

You might restart tomcat server,

make sure the memory is increased by

ps aux | grep java