Lab 4 - Apache Web Server Installation
Lab 4 - Apache Web Server Installation
Materials:
PC with Java SDK and JCreator installed.
Internet Connection
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.
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:\autoexec.bat file.
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/server.xml and change the port attribute of the
Connector element from 8080 to 80.
To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector
element from 8080 to 80, yielding a result similar to that below.
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 http://localhost/yourWebApp/l
instead of http://localhost:8080/yourWebApp/. The yourWebApp is the context root of the web
application.
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/web.xml 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/web.xml file).
To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements in
install_dir/conf/web.xml. Do not confuse this Apache Tomcat-specific web.xml file with the
standard one that goes in the WEB-INF directory of each Web application.
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
...
</servlet>
...
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
1. Verify that you can start the server. Double-click install_dir/bin/startup.bat and try accessing
http://localhost/.
To make sure that the server is installed and configured properly, click on
install_dir/bin/startup.bat. Next, enter the URL http://localhost/ 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.