F0102
Laboratory Exercise 4: Apache Web Server
Installation
At the end of the exercise, the students should be able to:
Install and configure a Web server.
Install and configure a database server.
Describe the operation of Apache Tomcat.
Materials:
PC with Java SDK and JCreator installed.
Internet Connection
Perform the following instructions:
Make sure JDK 1.5 or 1.4 is installed and your PATH is set so that both "java -version" and "javac -help"
give a result.
A. Install and Configure Tomcat.
1. Download the software. Go to [Link] Download and unpack
the zip file for the current release build of Tomcat 5.5.
Save the zip file(s) on your PC and unzip into a location of your choice. You specify the top-level
directory (e.g., C:\) and the zip file has embedded subdirectories (e.g., apache-tomcat-5.5.17).
Thus, C:\apache-tomcat-5.5.17 is a common resultant installation directory.
2. Set the JAVA_HOME variable. Set it to refer to the base JDK directory, not the bin subdirectory.
Failing to properly set this variable prevents Tomcat from compiling JSP pages. This variable
should list the base JDK installation directory, not the bin subdirectory. For example, on almost
any version of Windows, if you use JDK 1.5_08, you might put the following line in your
C:\[Link] file.
set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08
Laboratory Exercise 4: Apache Web Server Installation * Property of STI
Page 1 of 4
F0102
On Windows XP, you could also go to the Start menu, select Control Panel, and choose System.
Click on the Advanced tab, press the Environment Variables button at the bottom, and enter the
JAVA_HOME variable and value directly. On Windows 2000 and NT, you go to Start, Settings,
Control Panel, System, and then Environment.
3. Change the port to 80. Edit install_dir/conf/[Link] and change the port attribute of the
Connector element from 8080 to 80.
To change the port, edit install_dir/conf/[Link] and change the port attribute of the Connector
element from 8080 to 80, yielding a result similar to that below.
<Connector port="80" ...
maxThreads="150" ...
It is convenient to configure Tomcat to run on the default HTTP port (80) instead of the out-of-the-
box port of 8080. Making this change lets you use URLs of the form [Link]
instead of [Link] The yourWebApp is the context root of the web
application.
4. Turn on servlet reloading. Edit install_dir/conf/[Link] and change <Context> to
<Context reloadable="true">.
Fail to turn it on for your development server you'll have to restart the server every time you
recompile a servlet that has already been loaded into the server's memory. It is recommended to
turn this on.
5. Enable the invoker servlet. Go to install_dir/conf/[Link] and uncomment the servlet and servlet-
mapping elements that map the invoker servlet to /servlet/*.
The invoker servlet lets you run servlets without first making changes to your Web application's
deployment descriptor (i.e., the WEB-INF/[Link] file).
To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements in
install_dir/conf/[Link]. Do not confuse this Apache Tomcat-specific [Link] file with the
standard one that goes in the WEB-INF directory of each Web application.
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
Laboratory Exercise 4: Apache Web Server Installation * Property of STI
Page 2 of 4
F0102
[Link]
</servlet-class>
...
</servlet>
...
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
B. Test the server.
1. Verify that you can start the server. Double-click install_dir/bin/[Link] and try accessing
[Link]
To make sure that the server is installed and configured properly, click on
install_dir/bin/[Link]. Next, enter the URL [Link] in your browser and make sure you
get the Tomcat welcome page, not an error message saying that the page could not be displayed
or that the server could not be found.
Take a screen shot of the Tomcat welcome page. Browse the welcome page by seeing some
sample application. Make a reaction about the installation and configuration of Apache Tomcat.
Write your reaction below.
Laboratory Exercise 4: Apache Web Server Installation * Property of STI
Page 3 of 4
F0102
Laboratory Exercise 4: Apache Web Server Installation * Property of STI
Page 4 of 4