For the complete documentation index, see llms.txt. This page is also available as Markdown.

38.5 Tomcat Application Server

This section describes how to deploy the Tomcat application server on the FreeBSD operating system.

Installing Tomcat

Install using the pkg package manager:

# pkg install tomcat110

If installing using Ports:

# cd /usr/ports/www/tomcat110/
# make install clean

Configuring Tomcat

The Tomcat 11 installation directory is located at /usr/local/apache-tomcat-11.0.

/usr/local/apache-tomcat-11.0/
├── bin/
├── conf/
   ├── server.xml
   └── web.xml
├── webapps/
├── logs/
└── work/

Its main directory structure:

Directory
Description

bin/

Stores startup, shutdown, and other script files

conf/

Stores configuration files, including server.xml (main configuration file, copied from server.xml.sample) and web.xml (default web application configuration, copied from web.xml.sample)

webapps/

Web application deployment directory

logs/

Log file directory

work/

Temporary working directory for compiled JSP files

Tomcat Service

Add to startup items and set the Tomcat service to start at boot:

Start the Tomcat service:

Open ip:8080, for example http://192.168.179.150:8080/, to access the Tomcat default page:

Tip

The 192.168.179.150 in the above example is a placeholder and needs to be replaced with the actual value.

Tomcat FreeBSD

Basic Configuration Notes

The main Tomcat configuration file is /usr/local/apache-tomcat-11.0/conf/server.xml, which defines core components such as service ports, connectors, engines, and hosts. By default, Tomcat listens on port 8080 for HTTP connections. The AJP (Apache JServ Protocol) connector is not enabled by default; if needed, uncomment it in server.xml to enable port 8009. To modify the port or configure HTTPS support, edit this configuration file.

Web applications should be deployed in the /usr/local/apache-tomcat-11.0/webapps/ directory; Tomcat will automatically load WAR packages or unpacked web application directories under this directory.

Last updated