Tomcat Web Server Installation & Configuration
1. Introduction
It is an application server or web server or servlet container developed by the Apache Software Foundation (ASF) and released under the Apache License version 2. HTTP web servers provide an environment for Java code to run in. It includes tools for configuration and management, but can also be configured by editing XML configuration files. Most of the modern Java web frameworks are based on servlets and JavaServer Pages and can run on Apache Tomcat, for example Struts, JavaServer Faces, Spring, etc.
2. Download and install
2. Download and install
Go to http://tomcat.apache.org/download-70.cgi then go to the Binary Distribution/Core/and download
Installation steps
3. Configuration
The configuration files of the Apache Tomcat Server are located in the "conf" sub-directory of our Tomcat installed directory, for example "C:\Program Files\Apache Software Foundation\tomcat7.0.40\conf".
There are 4 configuration XML files:
1. context.xml file
2. tomcat-users.xml file
3. server.xml file
4. web.xml file
2. tomcat-users.xml file
3. server.xml file
4. web.xml file
Step 3(a) "conf\web.xml"; Enabling a Directory Listing
Open the configuration file "web.xml". We shall enable the directory listing by changing
"listings" from "false" to "true" for the "default" servlet.
<param-value>true</param-value> like:
Step 3(b) "conf\server.xml file"; set the TCP Port Number
Open the file "server.xml" in a text editor.
The default port number of Tomcat is 8080. Now we need to change the TCP port number for Tomcat, since the same port number can be used by other servers like SQL Server. We may choose any number between 1024 and 65535.
Locate the following lines, and change port="8080" to port="9999". Like:
<Connector port="9999" protocol="HTTP/1.1" Like
Step 3(c) "conf\context.xml"; Enabling Automatic Reload
In that we set reloadable="true" to the <Context> element to enable automatic reload after code changes.
Add reloadable="true" as in the following:
<Context reloadable="true">
......
</Context> Like
Step 3(d) (Optional) "conf\tomcat-users.xml"
It is used to manage Tomcat by adding the highlighted lines, inside the <tomcat-users> elements.
In that we can add a password and username as an optional step.
In that we can add a password and username as an optional step.
4. Start the tomcat server
Executable programs and scripts are kept in the "bin" sub-directory of the Tomcat installed directory.
Open a browser then enter the URL "http://localhost:9999" to access the Tomcat server's welcome page.
If we get this type of page then it means we are done.
If we get this type of page then it means we are done.
No comments:
Post a Comment