Tomcat installation

Package installation

First, install the Tomcat server packages. Jiglu will work with Tomcat versions 8.0, 8.5 and 9.0. On OpenSuse use:

zypper install tomcat

On Amazon Linux instead use:

amazon-linux-extras install tomcat8.5


Configuration files for Tomcat are normally located in /etc/tomcat or /etc/tomcat8. Changes will need to be made to the following files:

tomcat.conf / tomcat8.conf

Changes need to be made to made to enable headless mode so image processing can be used without a display, to allow encoded slashes in URLs, to disable message compression with web sockets and to set a reasonable memory size. Normally this will be through adding or changing the CATALINA_OPTS property:

CATALINA_OPTS="-Djava.awt.headless=true -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Dorg.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS=true -Xmx512M"


Development mode should be turned off for the jsp servlet:



A host definition will need to be added for the server:

<Host name=""

<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<Valve className="org.apache.catalina.valves.ErrorReportValve"
showServerInfo="false" />

The RemoteIpValve is required to pass through details of the remote IP address for logging purposes. The ErrorReportValve will prevent details of the server internals being shown to users for malformed requests.

In the connector definition you will want to increase the maximum size for a discarded upload so if users try and upload too large a file they will get an error message rather than having the connection reset by Tomcat, though enforcing a maximum is still a good idea. You may also want to allow compression for scripts and stylesheets:

<Connector port="8080" protocol="HTTP/1.1"
redirectPort="8443" />

Deployment descriptor

In the Catalina directory, add a deployment descriptor by creating a directory with the same name as the host name above and inside it adding a ROOT.xml file:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/opt/jiglu/webapp" path="">
override="false" />
override="false" />

The host value will need to be that of the machine where the Jiglu server can be found and the RMI port value that of the port number, as found in the Jiglu file.

Automatic starting

To enable Tomcat to start when the server is booted use:

systemctl enable tomcat

Tomcat will be started later in the installation process.

Written by Stephen Hebditch. Published on .
Installing and configuring the Tomcat web container.