Chapter 7. Configuration Files and Their Elements
After you have Tomcat running, you will soon find a need to customize its configuration. For example, you might want to support virtual hosting. Tomcat also features realms, which are lists of users authorized to use specific sections of your web site. Using realms, we show you how to set up an example JDBC domain to talk to a relational database. We also show you many of the other configuration changes that you can make.
Configuring Tomcat is done by editing files and restarting Tomcat. The main configuration files provided with Tomcat 4 that reside in the $CATALINA_HOME/conf directory are:
- server.xml
The main Tomcat 4 configuration file.
- web.xml
A servlet specification standard format configuration file for servlets and other settings that are global to all web applications.
- tomcat-users.xml
The default list of roles, users, and passwords used by Tomcat’s
UserDatabaseRealm
for authentication.- catalina.policy
The Java 2 Standard Edition security policy file for Tomcat.
The first three files are well-formed XML documents, and they are parsed by Tomcat at startup; the web.xml file is also validated against an XML document type definition (DTD). The syntax of every important part of these configuration files is discussed in detail in this chapter; the elaboration of their usage and meaning makes up most of the rest of this book.
Tip
Note that the major elements in server.xml begin with a capital letter, whereas all of the elements in web.xml
Get Tomcat: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.