3SE-SPI Applications of the Tool Group.........................................................................................50
4SE SPI Applications of the Policy Group.......................................................................................50
7
Page 8
8
Page 9
Introduction
Executive Summary
The HP Open Source Integrated Portfolio (HP OSIP) comprises a range of products and services
designed to verify that customers can successfully realize the cost and feature benefits of adopting
open source software in their IT environments. HP Open Source foundation components include
the base components of an open source-based ecosystem. HP servers and storage are validated
to run the Linux operating system together with the supported commercial Linux distribution.
HP Open Source Middleware Stacks offer building block applications, such as the Web Server;
technical blueprints, such as this document, describing how to integrate individual components
of a technology stack; and consulting services to speed the successful implementation of an open
source strategy.
Intended Audience
The intended audience for this document is enterprise customers who are evaluating or deploying
an open source Web Server on HP ProLiant servers running SUSE Linux Enterprise Server Version
10 (SLES10).
Scope and Purpose
This blueprint provides technical information for the implementation of an open source Web
Server Middleware Stack. It covers installation of the initial Linux distribution and middleware
building blocks, integration of the components, and steps for verification of stack functionality.
The software components described in this paper are tested and validated to run on HP ProLiant
servers and StorageWorks products.
HP provides quality assurance from extensive integration testing with open source software and
HP hardware so that you can confidently deploy the complete stack. Once you have completed
a successful evaluation, you have the flexibility to “do it yourself” or get assistance from HP to
incorporate open source stacks into your existing IT infrastructure.
HP Services
HP Open Source Consulting Services can help you build and integrate open source and commercial
software across multiple operating systems (OS) environments. Additionally, HP Open Source
Support Services provide industry leading technical support for all the products HP sells,
including hardware, operating systems, and open source middleware.
NOTE:While HP does not offer support for JDK, JVM, and components directly, a number of
commercial support options are available for these components. HP can help you integrate those
offerings into one support strategy.
To learn more about HP Open Source Consulting and Support Services, contact your local HP
sales representative or visit the HP Business and IT Services website at:
http://www.hp.com/hps
Introduction9
Page 10
Typographic Conventions
This document uses the following typographical conventions.
Command
ComputerOut
Ctrl-xA key sequence. A sequence such as Ctrl-x indicates that
ENVIRONVARThe name of an environment variable, for example, PATH.
[ERRORNAME]
KeyThe name of a keyboard key. Return and Enter both refer
TermThe defined use of an important word or phrase.
UserInput
VARIABLE
\ (continuation character)
...The preceding element can be repeated an arbitrary number
|Separates items in a list of choices.
A command name or qualified command phrase.
Text displayed by the computer.
you must hold down the key labeled Ctrl while you press
another key or button.
The name of an error, usually returned in the errno
variable.
to the same key.
Commands and other text that you type.
The name of a placeholder in a command, function, or
other syntax display that you replace with an actual value.
A backslash (\) at the end of a line of code (such as a
command) indicates that the following line of code is
contiguous, and you must not insert a line break. This
convention facilitates the typesetting of long lines of code
examples on a printed page. If you cut and paste sample
code from this publication, ensure that you remove
backslash characters at line endings.
of times.
HP Encourages Your Comments
HP encourages your comments concerning this document. We are committed to providing
documentation that meets your needs. Send any errors found, suggestions for improvement, or
compliments to:
feedback@fc.hp.com
Include the document title, manufacturing part number, and any comment, error found, or
suggestion for improvement you have concerning this document.
10
Page 11
HP Open Source Web Server Middleware Stack
The following components comprise the HP OSMS Web Server Middleware Stack:
Apache Web ServerThe Apache Web Server is a mature open source web server that has
become the de facto standard because of its high adoption rate on
the Internet.
Apache Tomcat
HibernateHibernate is an object/relational persistence and query service for
mod_jk
mod_ssl
PerlPerl (Practical Extraction and Report Language) has long been a
PHPPHP is a scripting language that can be embedded in HTML pages,
PythonPython is an object-oriented language that has a clean, straightforward
JDKThe Java Platform Standard Edition Development Kit (JDK) is a
Apache Tomcat (or Tomcat) is a J2EE servlet and Java™ Server Pages
(JSP) engine for developing and deploying web applications. It also
includes other features, such as an embedded web server.
Java. Hibernate provides support for collections and object relations,
and composite types. In addition to persisting objects, Hibernate
provides a rich query language to retrieve objects from the database,
and an efficient caching layer and Java Management Extensions (JMX)
support. User-defined data types and composite primary keys give
additional flexibility to support legacy applications.
The mod_jk module is commonly used to allow Tomcat to handle
Java Servlet and JSP requests while Apache httpd handles requests
for static and dynamic contents implemented in PHP, Perl, or Python.
The mod_ssl module provides a Secure Sockets Layer (SSL) and
Transport Layer Security (TLS) implementation that allows web
applications running within the Apache Web Server to communicate
securely with their respective clients. Communication can still occur
over standard HTTP while running mod_ssl.
popular text-processing language. Recently, Perl has become popular
for the development and deployment of web applications.
allowing developers to add more dynamic contents to their web
applications. A large portion of the PHP syntax is similar to C and
Java.
syntax. Python can be extended to exploit facilities implemented in
other programming languages, such as C and C++.
development platform for building Java-based applications and
components.
Web Server Stack Architecture
This section provides architecture, configuration, and the software environment for a web server
stack. Figure 1 shows the logical architecture of the stack.
HP Open Source Web Server Middleware Stack11
Page 12
Figure 1 Web Server Stack Architecture
Table 1 lists the software used to test the configurations described in this blueprint.
Table 1 Software Test Configuration
Software
Tomcat
Version
2.2.0-21.2Apache httpd
5.5.20Apache
3.2.1Hibernate
2.2.0-21.2mod_ssl
1.2.20mod_jk
5.8.8-14.2Perl
5.1.2-29.5PHP
2.4.2-18.2Python
1.5.0_10Sun JDK
apache2.2.0-21.2.x86_64.rpm
apache-tomcat-5.5.20.tar.gz
hibernate-3.2.1.tar.gz
apache2-prefork-2.2.0-21.2.x86_64.rpm
tomcat-connectors-1.2.20-src.tar.gz
perl-5.8.8-14.2.x86_64.rpm
php-5.1.2-29.5.x86_64.rpm
python-2.4.2-18.2.x86_64.rpm
jdk-1_5_0_10-linux-amd64-rpm.bin
Novell
Apache
Website LinkDistributorPackage NamePackage
Apache httpd
website
Apache Tomcat
website
Hibernate websiteHibernate
mod_ssl websiteNovellInclude with
mod_jk websiteApache
Perl websiteNovell
PHP websiteNovell
Python websiteNovell
Sun Java websiteSun
12
Page 13
NOTE:The installation and configuration of the MySQL and Oracle databases are not covered
in this blueprint. The MySQL and Oracle databases are installed on a separate HP ProLiant
servers with database files on Modular Smart Array (MSA) 1000 storage. All other software listed
in Table 1 are installed on HP ProLiant servers, as displayed in Figure 2.
Figure 2 Web Server Hardware Environment
Figure 2 shows a basic configuration consisting of multiple nodes of an Apache Web Server as
the load balancer. The key processes that occur are as follows:
•Connection of the Apache Web Server and the Tomcat Web Container, using the mod_jk
module.
•Connection of Apache Tomcat Server to a database, such as MySQL or Oracle, using a JDBC
Driver.
•Support from Apache Web Server for login authentication using Java Authentication and
Authorization Service (JAAS) with the Symas Connexitor Directory Services (CDS) Server.
•Use of an additional, required OpenView Management Server to host HP OpenView
Operations (OVO) for manageability through the Apache Web Server.
For a checklist that provides high-level guidelines for building the web server stack, see “Appendix
A: Checklist for Building a Web Server Middleware Stack” (page 51).
Installing and Verifying the Linux Distribution
This section describes how to build a Web Server Middleware Stack, beginning with the
installation of the Linux distribution.
Installing the Linux Distribution
Complete instructions for installation of a Linux distribution are outside the scope of this
document. This section provides information to verify installation of the required packages for
the OSMS Web Server.
Required Packages and Installation Recommendations
The Web Server Middleware Stack depends on several software package groups included with
the SLES10 distribution media. To verify package selection, perform the following steps:
1.From the Installation Settings screen of YaST, select the Software tab.
Installing and Verifying the Linux Distribution13
Page 14
2.Under the Primary Functions heading, select Web and LAMP Server and under the
Development heading, select C/C++ Compiler and Tools as displayed in Figure 3.
Figure 3 YaST Software Selection and System Tasks
3.Select the Details button to display a table with the detailed software package selections.
4.From the Filter options drop-down list, select Package Groups.
5.In the Package Groups pane, expand the Development group and select Languages from
the expanded list.
Verify that the perl and python components are selected as displayed in Figure 4
Figure 4 SUSE Installation Settings
6.From the Productivity packages group, select Networking.
Verify that the apache2, apache2-prefork, php5, apache2-mod_perl, apache2-mod_php5,
apache2-mod_python, and webalizer components are selected.
Verifying the Linux Distribution Installation
To verify installation of the necessary packages, enter the following command:
If any of these packages are not installed, locate the RPM package on the Linux distribution
media, and install the missing package.
NOTE:By default, the installation enables the iptables firewall, which prevents external
systems from accessing ports below 1024. See “Appendix B: Frequently Asked Questions”
(page 53) and verify the firewall is disabled or the appropriate rules are set to allow the Apache
and Tomcat connection. The system verification steps described later in this document will not
work if the iptables firewall is improperly configured.
Installing, Configuring, and Managing Web Server Middleware Stack
Components
This section explains how to install, configure, and manage the Web Server middleware stack
components not included in the Linux distribution along with other related components. All
components are distributed as RPM packages or binaries, therefore, you can install and remove
all the components separately. Table 1 (page 12) lists the appropriate version and additional
information. You must install the following components separately:
•SUN JDK
•Tomcat
Configuring the Basic Apache HTTP Server
Use the following procedure to configure a basic Apache HTTP Server.
1.Start Apache by entering the following:
# /etc/init.d/apache2 start
2.Verify that Apache starts successfully by ensuring that messages similar to the following
appear in the log file /var/log/apache2/error_log:
[Sat Feb 03 12:41:21 2007] [notice] Apache/2.2.0 (Linux/SUSE) configured -- resuming normal operations
3.Create a file named /srv/www/htdocs/apache.html and add the following lines:
<HTML>
<HEAD>
</HEAD>
<BODY DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>Apache http server worked !</FONT>
</FONT></P>
</BODY>
</HTML>
Verify the Apache installation by opening a browser and entering the following website:
http://<YOUR_WEB_SERVER_IP>/apache.html
The following message appears:
Apache HTTP server worked !
Installing and Configuring Sun JDK on an HP Proliant System
For an HP Proliant system, the following procedure to install and configure a Sun Java
Development Kit (JDK):
Installing, Configuring, and Managing Web Server Middleware Stack Components15
Page 16
1.Download the Sun JDK package from the Java website and install as follows (see Table 1
(page 12) for the correct version and website link):
Change to the Sun JDK install package directory, as appropriate for your system, and install
the package by entering the following command:
# chmod 755 jdk-1_5_0_10-linux-amd64-rpm.bin
# ./jdk-1_5_0_10-linux-amd64-rpm.bin
2.Create a symbolic link for Sun JDK by entering the following:
# ln -s /usr/java/jdk1.5.0_10 /usr/local/jdk
3.The JAVA_HOME environment variable must be properly set before stack components, such
as Tomcat, can begin executing.
To export the JAVA_HOME environment variable, modify the system file that is appropriate
for your shell, /etc/profile.d/alljava.sh or /etc/profile.d/alljava.csh:
For the alljava.sh file, add the following lines:
if [ -x /usr/local/jdk/bin/java ] ; then
export PATH=$PATH:/usr/local/jdk/bin
export JAVA_BINDIR=/usr/local/jdk/bin
export JAVA_ROOT=/usr/local/jdk
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk
unset JDK_HOME
unset SDK_HOME
export JDK_HOME=/usr/local/jdk
export SDK_HOME=/usr/local/jdk
else
if [ -x /usr/lib/java/jre/bin/java ] ; then
# it is IBMJava2-JRE or SunJava2-JRE
export PATH=$PATH:/usr/lib/java/jre/bin
export JAVA_BINDIR=/usr/lib/java/jre/bin
export JAVA_ROOT=/usr/lib/java
export JAVA_HOME=/usr/lib/java/jre
export JRE_HOME=/usr/lib/java/jre
unset JDK_HOME
unset SDK_HOME
fi
fi
For the alljava.csh file, add the following lines:
4.Log out of the system, and then log back in to start using the revised profile.
5.Verify the Sun JDK installation was successful by entering the following:
# java –version
The following messages appear:
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_10-b03, mixed mode)
Installing and Configuring Tomcat
The following procedure provides the steps for installing and configuring Tomcat.
NOTE:Prior to installing Apache Tomcat, you must verify that JDK is installed and configured
on your system.
1.Download the Tomcat Web Server package from the Apache Software Foundation website
and follow the instructions provided to install it. See Table 1 (page 12) for the correct version
and website link.
NOTE:In the following steps, it is assumed that Tomcat is installed in
/usr/local/apache-tomcat; if Tomcat is installed in a different directory, replace
/usr/local/apache-tomcat with the correct path.
2.Set the CATALINA_HOME environment variable to the Tomcat directory path by editing
/etc/profile and adding the following lines to the end of the file:
3.Log out of the system, and then log back in to it to start using the revised profile.
4.Start Tomcat by entering the following:
# /usr/local/apache-tomcat/bin/startup.sh
The following messages appear:
Using CATALINA_BASE: /usr/local/apache-tomcat
Using CATALINA_HOME: /usr/local/apache-tomcat
Using CATALINA_TMPDIR: /usr/local/apache-tomcat/temp
Using JRE_HOME: /usr/local/jdk
5.Verify that the Tomcat installation once the startup is complete by opening a browser and
entering the following URL:
Installing, Configuring, and Managing Web Server Middleware Stack Components17
Page 18
NOTE:If the iptables firewall is enabled, you will not be able to connect to Tomcat from
a remote computer.
6.If necessary, stop Tomcat by entering the following command:
# /usr/local/apache-tomcat/bin/shutdown.sh
The following messages appear:
Using CATALINA_BASE: /usr/local/apache-tomcat
Using CATALINA_HOME: /usr/local/apache-tomcat
Using CATALINA_TMPDIR: /usr/local/apache-tomcat/temp
Using JRE_HOME: /usr/local/jdk
Advanced Apache HTTP Server Features
The following section describes several widely used Apache HTTP Server features.
Using the Apache HTTP Server Benchmarking Tool
The benchmarking tool is supplied with the Apache HTTP Server and is used to benchmark your
Apache HTTP Server and monitor its performance. For example, you can use the benchmarking
tool to perform concurrency requests to an Apache HTTP Server. Use the following command
to start using the benchmarking tool:
# /usr/ab2
Additionally, you can verify the stability of the Apache HTTP Server by running a basic stress
test on the test system. The following steps show a stress test for an example system:
1.Create a file using the following path name: /srv/www/htdocs/abtest.html
2.Add the following lines to the file you created in Step 1:
<HTML>
<HEAD>
</HEAD>
<BODY DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>The page is used for Apache benchmarking test !</FONT>
</FONT>
</P>
</BODY>
</HTML>
3.Perform a concurrency request to the test system by logging into another system and entering
the following command:
You can force a heavier load on the Apache HTTP Server by increasing the number of concurrency
requests with the -c option, and by prolonging the testing round by increasing the number of
requests with the -n option.
NOTE:If you encounter the following error:
socket: Too many open files (24)
You can correct the error by entering the following:
# ulimit -n <NUMBER>
This command increases the limit on the number of open files only for the current shell session.
The increased limit is applicable to the newly launched commands on that shell after the change.
Commands that you launched previously continue to use the previous limit.
Apache HTTP Server Status and Information
You can obtain various pieces of information regarding your Apache HTTP Server by configuring
the mod_status and mod_info module requests within the httpd.conf configuration file.
The mod_status module is configured using the server-status request and the mod_info
module is configured using the server-info request. For example, you can find out the current
hosts and requests being processed, whether the server was started or restarted, and basic server
configuration information. These two functions help you monitor your Apache HTTP Server.
Configuring and Using the Modules
Use the following steps to enable these two modules to collect and display information.
1.Edit the /etc/apache2/mod_status.conf file and add the following lines:
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from YOUR_WEB_BROWSER_IP
</Location>
</IfModule>
2.Edit the /etc/apache2/mod_info.conf file and add the following lines:
<IfModule mod_info.c>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from YOUR_WEB_BROWSER_IP
</Location>
</IfModule>
3.Modify the /etc/sysconfig/apache2 file by appending the following to the
APACHE_MODULES definition:
info status
The APACHE_MODULES definition should now look like the following:
APACHE_MODULES="actions alias auth_basic authn_file authz_host
authz_groupfile authz_default authz_user authn_dbm autoindex cgi
dir env expires include log_config mime negotiation setenvif ssl
suexec userdir php5 info status"
4.Restart the Apache HTTP Server for the changes take effect.
Installing, Configuring, and Managing Web Server Middleware Stack Components19
Page 20
5.Verify that the /etc/apache2/sysconfig.d/loadmodule.conf file contains the
If these two lines exist , then the two modules have loaded successfully.
Use the following procedure to verify the server status and display the server information web
page:
1.Verify the server status by opening a browser and entering the following URL:
http://<YOUR_WEB_SERVER_IP>/server-status
The Apache Server Status web page opens, as shown in Figure 6.
Figure 6 Apache Server Status
2.Display the server information web page by opening a browser and entering the following
website:
http://<YOUR_WEB_SERVER_IP>/server-info
The Apache Server Information web page opens, as shown in Figure 7.
Figure 7 Apache Server Information
20
Page 21
Apache HTTP Server Log
The Apache HTTP Server provides a detailed and flexible information-logging mechanism. The
two most important log files are the error and access logs. The default location for the Apache
HTTP Server log files is the following directory: /var/log/apache2
Using the Error Log to Diagnose the Apache HTTP Server
The Apache HTTP Server records diagnostic information and all errors encountered while
processing requests to the error log file, error_log.
For example, if you visit a nonexistent URL, the following 404 error is generated:
The requested URL /non-exist/ was not found on this server.
All error information is recorded in the default error log file, which you can obtain by entering
the following command:
# tail –f /var/log/apache2/error_log
The following message is added to the end of the file:
[Sat Feb 03 13:03:55 2007] [error] [client 10.100.0.86] File does not exist:
/srv/www/htdocs/non-exist
Using Webalizer to Perform Apache HTTP Server Log Analysis
Webalizer is an analysis tool that you can use to generate detailed usage reports using the
information recorded in the Apache HTTP Server logs. Webalizer provides easy-to-read reports
in HTML format that you can customize for your needs.
Use the following procedure to set up Webalizer:
1.Modify the Webalizer configuration file, /etc/webalizer.conf, by adding the following
2.Restart the Apache server by entering the following:
# /etc/init.d/apache2 restart
3.Run the Webalizer program to generate a report:
# webalizer
A message similar to the following appears:
Webalizer V2.01-10 (Linux 2.6.16.21-0.8-smp) English
Using logfile /var/log/apache2/access_log (clf)
DNS Lookup (10): 1 addresses in 1.00 seconds, 1/sec
Using DNS cache file dns_cache.db
Creating output in /srv/www/htdocs/webalizer
Hostname for reports is 'bl35p-16'
Reading history file... webalizer.hist
Generating report for February 2007
Generating summary report
Saving history information...
307 records in 1.00 seconds, 307/sec
Verify that the server status configuration is correct by opening a browser and entering the
following website:
http://<YOUR_WEB_SERVER_IP>/webalizer
Figure 8 shows an example of a Webalizer usage report web page.
Installing, Configuring, and Managing Web Server Middleware Stack Components21
Page 22
Figure 8 Webalizer Usage Report
For detailed information, see the Webalizer website at:
http://www.mrunix.net/webalizer/
Using Virtual Host Support
A virtual host runs more than one website on a single server. For example, www.website1.com
and www.website2.com can be hosted on the same server.
The most widely used virtual host is "name-based," which means that multiple names are running
on one IP address. Because the user provides the hostname as part of the URL, the user is not
aware that various websites are using the same IP address.
The following example steps illustrate the use of virtual hosting:
1.To configure virtual hosting, you must resolve two host names to the same IP address. One
method is to edit the /etc/hosts file of the client system as follows:
•For Windows systems, edit the C:\WINDOWS\system32\drivers\etc\hosts file.
10. Restart your Apache HTTP server for the changes to take effect.
11. Verify that the virtual hosting configuration operates properly by opening a browser and
entering the following website:
www.website1.com
The following message appears:
This is www.website1.com
Open a second browser and enter the following website:
www.website2.com
The following message appears:
This is www.website2.com
Using Apache HTTP Server URL Redirection
The following procedure illustrates the use of the URL redirection feature which allows you to
configure the Apache HTTP server to send requests for one URL to another URL. This requires
the use of two servers that are both running Apache HTTP server.
1.On the first server, create the following directory:
/srv/www/htdocs/testdir
2.On the second server, create the following HTML file:
/srv/www/htdocs/test.html
3.Add the following lines to the file you created in Step 2:
5.Use the following command to restart your Apache HTTP server, for the preceding changes
to take effect:
# /etc/init.d/apache2 restart
6.Verify that the URL redirect configuration is correct by opening a browser and entering the
following website:
http://<YOUR_WEB_SERVER_IP>/testdir
The following message appears:
The URL redirect is successful!
Using Apache HTTP Server Proxy Features
The proxy features within the Apache HTTP server enable your server to act as a Proxy server
(a network gateway).
The following procedure illustrates the use of URL redirection. The procedure requires the use
of three systems that are all running identical Linux distributions. The first system functions as
an Apache HTTP server, the second functions as the Apache Proxy server, and the third system
is a web client.
1.Start the Apache HTTP server on the first system.
2.Modify the /etc/sysconfig/apache2 file by appending the following string to the
APACHE_MODULES definition:
proxy proxy_connect proxy_ftp proxy_http
The APACHE_MODULES definition should now look like the following:
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user
authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir
php5 info status proxy proxy_connect proxy_ftp proxy_http"
24
3.On the second system, which acts as the Apache Proxy server, edit the following file:
/etc/apache2/default-server.conf
Add the following lines to the preceding file:
ProxyRequests On
ProxyVia On
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>
4.Restart the Apache HTTP server, so the Apache Proxy server will take effect on the second
system, by entering the following:
# /etc/init.d/apache2 restart
5.Using the benchmarking tool, test the Apache Proxy server using the third system, which
acts as the web client:
These messages verify that the Apache Proxy server configuration is successful.
Error Responses and Redirects
The following three types of error responses can be customized and are addressed in this section:
•Plain text
•Local URL redirect
•External URL redirect
Customizing Plain Text Responses
The following is an example of how to customize a plain text error response:
1.Edit the following file:
/etc/apache2/errors.conf
In the preceding file, change (or add, if it does not exist already) the following line:
ErrorDocument 404 "The page you requested does not exist! Plain text example"
2.Restart your Apache HTTP server for the changes take effect.
3.Verify the custom text error message by opening a browser and entering the following
website:
http://<YOUR_WEB_SERVER_IP>/non-exist
The following message appears:
The page you requested does not exist! Plain text example
Customizing Local URL Redirect Responses
The following is an example for customizing a local URL redirect error message:
1.Edit the following file:
/etc/apache2/errors.conf
In the preceding file, change (or add, if it does not exist already) the following line:
ErrorDocument 404 "/missing.html"
2.Create the following HTML file:
/srv/www/htdocs/missing.html
Add the following lines to the preceding file:
<HTML>
<HEAD>
</HEAD>
<BODY DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>The page you request does not exist!
Local redirects example</FONT></FONT></P>
</BODY>
</HTML>
Installing, Configuring, and Managing Web Server Middleware Stack Components25
Page 26
3.Verify the custom local URL redirect message by opening a browser and entering the
following website:
http://<YOUR_WEB_SERVER_IP>/non-exist
The following message appears:
The page you request does not exist!
Local redirects example
Customizing External URL Redirect Responses
The URL redirect feature allows you to trap a missing link error (404 error) in a browser on a
local server, display a message, and then redirect it to a URL on an external server. The following
steps illustrate how to customize external URL redirect responses. The process requires the use
of two servers; one that acts as local server, another that acts as an external server. Use the
following procedure to customize external URL redirect responses:
1.Edit the following configuration file:
/etc/apache2/errors.conf
In the preceding file, change (or add, if it does not exist already) the following line:
Populate the preceding file with the following lines:
<HTML>
<HEAD>
</HEAD>
<BODY DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>The page you request does not exist!
External redirects example</FONT></FONT></P>
</BODY>
</HTML>
3.Verify the custom external URL redirect message by opening a browser and entering the
following website:
http://<YOUR_WEB_SERVER_IP>/non-exist
The following message appears:
The page you request does not exist!
External redirects example
Using Per-User Web Directories
Using the UserDir function, each user is allowed to have a personal website in their home
directory on servers that have multiple users. Visiting a URL with its name in the form
http://example.com/~username displays the contents of the home directory of the user.
The following is an example for configuring per-user web directories:
1.Add a user named tester to your server by entering the following commands:
# useradd -m tester
2.Create an HTML file named /home/tester/public_html/index.html that contains
the following lines:
<HTML>
<HEAD>
</HEAD>
<BODY DIR="LTR">
26
Page 27
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>The is personal homepage of user tester .</FONT>
</FONT></P>
</BODY>
</HTML>
3.Verify that the per-user web directory configuration was successful by opening a browser
and entering the following website:
http://<YOUR_WEB_SERVER_IP>/~tester
The following message appears:
The is personal homepage of user tester.
Integrating the Web Server Stack Components
This section describes the commonly used configurations for the Web server stack components.
Configuring the Apache and Tomcat Connector
The following section explains how to use the mod_jk module from the Apache Jakarta Project
(AJP) to connect the Apache Web server and the Tomcat Web Container.
The Apache HTTP server uses URL pattern rules, defined in the Apache Web server configuration
file, to determine which requests to handle and which to forward. It handles content, such as
static HTML pages, images, and CGI scripts. The Tomcat connector (mod_jk) uses the AJP
protocol to forward all requests for JSPs, servlets, and web functionality to Tomcat as shown in
Figure 9.
Figure 9 Connecting the Apache Web Server and Tomcat Web Container
The following example provides the steps to configure Apache Web server routing requests
under the DOCUMENT_ROOT/jsp-examples/ directory to the Tomcat server:
1.Download the mod_jk module from the Apache Software Foundation (see Table 1 (page 12)
for the correct version and website link), and follow the instructions provided to build the
mod_jk.so shared library. If necessary, copy the mod_jk.so file into the appropriate
directory as follows:
/usr/lib64/apache2/modules
2.Edit the Apache Web server configuration file, /etc/apache2/default-server.conf,
adding the following lines:
Installing, Configuring, and Managing Web Server Middleware Stack Components27
Page 28
3.Insert the following line below the DocumentRoot line:
JkMount /jsp-examples/* worker1
4.Before you can verify the Tomcat and Apache integration, you must set Tomcat to listen for
AJP13 requests. The JK module uses AJP to communicate with Tomcat so, you must verify
that the AJP <Connector> element is enabled in the Tomcat file server.xml and that this
file is placed inside the <Service> element.
Verify that the following lines are included and not commented out in the
The Apache Web server that is shipped with the supported Linux distribution includes a built-in
PHP module. Therefore, no extra configuration is required for Apache. Use the following
procedure to configure PHP:
1.Verify that PHP is installed by entering the following command:
# rpm -q php5 apache2-mod_php5
2.Create the following test file:
/srv/www/htdocs/test.php
Add the following lines to the preceding file:
<?
## test.php
phpinfo();
?>
3.Verify that PHP works by opening a browser and navigating to the following website :
http://<YOUR_HOSTNAME>/test.php
A web page containing the PHP version and license numbers is displayed.
Integrating the Apache Web Server and Perl
The apache2–mod_perl module integrates a Perl interpreter into the Apache Web server,
allowing you to use Perl when creating web applications. Use the apache2–mod_perl module
provided by the Linux distribution.
To test the installation, perform the following steps:
1.Verify that the apache2–mod_perl module is installed by entering the following command:
# rpm -q php5 apache2-mod_php5
2.Create a sample file test file named /srv/www/cgi-bin/test.pl and add the following
Installing, Configuring, and Managing Web Server Middleware Stack Components29
Page 30
Integrating the Apache Web Server and Python
The apache2–mod_python module embeds the Python environment into the Apache Web
server. Embedding this environment avoids the run-time overhead of starting the Python
environment externally.
Use the apache2–mod_python package provided by the Linux distribution.
1.Verify that the apache2–mod_python module is installed by entering the following
command:
# rpm -q python apache2-mod_python
2.Edit the /etc/sysconfig/apache2 file by adding python to the line with
APACHE_MODULES.
After completing this edit, the line should look like the following:
Connecting Tomcat to a database requires a JDBC driver for that particular database . The driver
is responsible for translating calls from Java programs to the native protocol that is understood
by the database. Figure 11 depicts the connection between Tomcat and a database using JDBC.
30
Page 31
Figure 11 Tomcat Connections Using JDBC
Tomcat uses the data-source concept to create database connections. A data source must be
configured in an XML configuration file. The data source provides details about the target
database, such as the database server IP address and login credentials. The JDBC driver connects
to the database and the username/password combination is used to login to the database. For
Tomcat 5.5, a data source is configured either in $CATALINA_HOME/conf/context.xml or in
/META-INF/context.xml within the web applications. By default, the data source support in
Tomcat is based on the Database Connection Pool (DBCP), which is used to create active
connections and manage the lifecycle of the individual connections automatically.
Connecting Tomcat and MySQL
MySQL is the leading open source database, and is used widely for web application middleware
environments. MySQL stores relational data and enables fast, simple access and updates to stored
data through the standard JDBC APIs. These APIs are supplied by MySQL in the form of the
Connector/J software. This section describes the steps to connect Tomcat to MySQL.
Obtaining and Installing the JDBC Drivers
Perform the following steps on the Tomcat web server:
1.Download the MySQL JDBC driver 5.0 from the MySQL website:
2.Start the Tomcat web server by entering the following command:
# $CATALINA_HOME/bin/startup.sh
Configuring the MySQL Server
To configure the MySQL database, perform the following steps on the MySQL server:
1.Verify that the MySQL server is running properly by entering the following command:
# ps -ef|grep mysqld
If the MySQL server is running, a process named mysqld displays in the output; otherwise,
enter the following command:
# /etc/init.d/mysql start
2.If the database used in the Tomcat data source does not exist, create the database by entering
the following command:
# mysqladmin -u root -p create osmsdb
The name of the database created in the command is osmsdb.
3.If the database user in the Tomcat data source does not exist, create the user and grant the
appropriate privileges by entering the following commands from the mysql prompt:
mysql> grant all on osmsdb.* to osmsuser@'%.%.%.%' identified by \
'osmsuser';
mysql> flush privileges;
The user named osmsuser with the password osmspass is created and is granted all
operation privileges on the database osmsdb.
Testing MySQL Database Connectivity
To test the connectivity between Tomcat and MySQL, perform the following steps on the Tomcat
web server:
32
Page 33
1.Create a JSP file named $CATALINA_HOME/webapps/ROOT/mysqltest.jsp and insert
2.If needed, start Tomcat by entering the following command:
# $CATALINA_HOME/bin/startup.sh
3.Verify Tomcat is connecting to MySQL by opening a browser and navigating to the following
website:
http://<YOUR_HOSTNAME>:8080/mysqltest.jsp
The test page opens as shown in Figure 12.
Figure 12 Tomcat Connecting MySQL Test Page
Connecting Tomcat and Oracle
Oracle is the leading commercial relational database. It is generally used to store and manage
sensitive and mission-critical data. As with MySQL, Oracle can also be used as the persistence
Installing, Configuring, and Managing Web Server Middleware Stack Components33
Page 34
layer for web applications. A JDBC connector for Oracle is needed to integrate an external Oracle
Database server with the Tomcat Web server. This section describes the steps for connecting the
Tomcat Web server to an Oracle database.
Obtaining and Installing the Oracle JDBC Driver
Perform the following steps from the Tomcat Web server:
1.Download the JDBC driver for Oracle 10g Release 2 from the Oracle website at:
2.If the Tomcat Web server is not running, start it by entering the following command:
# $CATALINA_HOME/bin/startup.sh
3.Verify that the Oracle test page is displayed (Figure 13 ) by opening a browser and navigating
to the following website:
http://<YOUR_HOSTNAME>:8080/oracleTest.jsp
Figure 13 Oracle Database Test
Installing, Configuring, and Managing Web Server Middleware Stack Components35
Page 36
Connecting Tomcat to MySQL or Oracle Using Hibernate
Hibernate is an open-source object and relational mapping framework. It uses a lightweight
object encapsulation for JDBC and allows JAVA developers to access data from databases using
JAVA objects. Hibernate is designed to run in a managed environment, such as the environment
of the web server. With Hibernate, you only need to configure a small part of the environment.
Hibernate inherits database connections from the application server. Therefore, it is easy to create
an enterprise application that uses Hibernate capabilities in the same way as other capabilities
available in the application server. You can obtain Hibernate and Hibernate tools from the product
websites. See Table 1 (page 12) for the appropriate links.
This section provides an example demonstrating the use of Hibernate for web applications using
a MySQL or Oracle database.
Installing Hibernate, Tomcat, and JDK
Download the Hibernate package, including tools, from the Hibernate website and install it using
the instructions provided. See Table 1 (page 12) for the correct version and website link.
Verify that you have installed and configured both Sun JDK and Tomcat before proceeding. For
additional information, see “Installing and Configuring Tomcat” (page 17).
Configuring a Database Driver in Tomcat
Verify that MySQL or Oracle are configured as data sources for Tomcat as described in
“Connecting Tomcat to a Database” (page 30) before proceeding.
To verify that the mysql-connector-java-<VERSION>.jar or ojdbc14.jar are configured,
go to the $CATALINA_HOME/common/lib directory and verify that the corresponding file exists.
Adding Test Data to the Databases
In order to verify that the MySQL or Oracle database interact properly with Tomcat, you must
populate the database with test data.
Add test data to the MySQL database using the following steps:
1.Log in to the MySQL command line tool by entering the following command:
# mysql -u root -p <PASSWORD>
2.Create a database named osmsdb and create a table named USERS by entering the following
commands:
mysql> create database osmsdb;
mysql> use osmsdb;
mysql> create table USERS(
mysql> User_id int(10) auto_increment not null primary key,
mysql> First_name varchar(30) not null,
mysql> Last_name varchar(30) not null
mysql> );
36
3.Add a user named osmsusr that uses the password osmspass and grant the appropriate
privileges to it by entering the following commands
mysql> create user 'osmsusr'@'%.%.%.%';
mysql> grant all on osmsdb.* to 'osmsusr'@'%.%.%.%' identified \
by 'osmspass';
Add test data to the Oracle database using the following steps:
Page 37
1.Log in to Oracle using the user name osmsusr and password osmspass by entering the
following command:
# sqlplus osmsusr/osmspass@osmsdb_ora
2.In the Oracle database identified by the Oracle SID, osmsdb_ora, create a table named
USERS, and then sequence with the osmsusr user by entering the following commands:
SQL> Create sequence hibernate_sequence start with 10 increment by
1 min value 10 maxvalue 999999999999;
SQL> Create table USERS ( user_id number(10) not null, first_name
varchar(30) not null, last_name varchar2(30) not null);
SQL> Alter table USERS add ( constraint user_primary_key primary
key(user_id) using index);
NOTE:The Oracle sequence, HIBERNATE_SEQUENCE, is used to generate a primary key
for the table named USERS.
Creating a Simple Application in Tomcat
You must create a simple application within Tomcat to facilitate verification of this functionality.
This simple application implements the insert, update, select, and delete functions for the USERS
table in the MySQL or Oracle database.
Use the following steps to create a simple application in Tomcat:
1.Create a directory named $CATALINA_HOME/webapps/SimpleDemo that contains the
appropriate subdirectories by entering the following commands:
2.Configure the MySQL or Oracle data source by creating a file named
$CATALINA_HOME/conf/Catalina/localhost/SimpleDemo.xml. Add the following
lines, depending on whether your database is MySQL or Oracle:
NOTE:The values of OracleDS and MySqlDS are the data source names that are configured
in the Tomcat Web server.
5.In Hibernate, a unit of work is named a session that is managed by SessionFactory.
To retrieve data for a session, create a utility named HibernateSessionFactory.java
located in $CATALINA_HOME/webapps/SimpleDemo/WEB-INF/classes/com/hp \
Page 39
/osms/hibernate/utility and add the following lines so the application can interact
with Hibernate:
The file HibernateSessionFactory.class is generated.
7.Create a Hibernate mapping file named Users.hbm.xml, in the directory
$CATALINA_HOME/webapps/SimpleDemo/WEB-INF/classes/com/hp/osms/hibernate
according to the definition in the USERS table that contains the following lines:
8.Hibernate uses a Plain Old Java Object (POJO) to pass values between the application tier
and the persistent tier. Change your default directory to the following path:
# cd $CATALINA_HOME/webapps/SimpleDemo/WEB-INF/classes \
/com/hp/osms/hibernate
In this directory, create a Hibernate POJO file named
$CATALINA_HOME/webapps/SimpleDemo/WEB-INF \
/classes/com/hp/osms/hibernate/Users.java according to the mapping file for
your application. Add the following lines:
package com.hp.osms.hibernate;
public class Users implements java.io.Serializable {
private Long userId;
private String firstName;
private String lastName;
public Users() {
}
public Users(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Long getUserId() {
return this.userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
40
9.Compile a Hibernate POJO file and move the class file into
$CATALINA_HOME/webapps/SimpleDemo/WEB-INF \
/classes/com/hp/osms/hibernate/Users.java by entering the following command:
10. Test Hibernate functionality such as inserting, updating, deleting, and retrieving data from
the database, by creating a sample JSP file named
$CATALINA_HOME/webapps/SimpleDemo/hibernate.jsp.
The following code fragment from hibernate.jsp shows how to use Hibernate to insert
data into the database:
NOTE:See “Appendix D: Hibernate Test Application Source Code” (page 55) for the
complete source code.
11. Restart Tomcat to make the configuration effective by entering the following:
# $CATALINA_HOME/bin/shutdown.sh
# $CATALINA_HOME/bin/starup.sh
Verifying the Simple Application Operation
Verify that the simple application operates properly to ensure that the connection between Tomcat
to MySQL and Oracle is operational by opening a browser and entering the following website:
The OSMS Hibernate Test web page is displayed as shown in Figure 14.
Figure 14 Verifying the Simple Application Configuration
Installing, Configuring, and Managing Web Server Middleware Stack Components41
Page 42
Secure the Web Server Stack
This section covers web server security.
•Data Transportation—Secure Sockets Layer (SSL) is a widely used technology to protect
data transfer. SSL enablement methods for both the Apache Web server and Tomcat
Application server.
•Application Authentication— Apache Web server provides a built-in authorization module
to enable access protection. Alternatively, Symas CDS provides a directory service solution
based on OpenLDAP, Berkeley DB, Cyrus SASL, and OpenSSL for more fine-grained
authentication purposes. CDS is an integrated authentication and authorization-based
security mechanism for enterprise applications managed and deployed in Apache httpd
and Tomcat Web servers. The directory server can store credential information and
application privileges about the users who are granted or forbidden access to specific
resources. In addition to controlling access based on user identities, OpenLDAP can control
access based on other attributes such as network address, transport, encryption strength,
dynamic relationships, and so on (for example, sets). Some applications or web pages in
specific applications in Apache Web server or Tomcat require access only by authenticated
users. Symas CDS provides this authentication mechanism by storing user credentials in
the directory server.
Enabling HTTPS Support in the Apache HTTP Server
The mod_ssl module provides an SSL implementation that allows web applications running
within the Apache Web server to communicate securely with their respective clients.
Communication can still occur over standard HTTP.
To enable HTTP over SSL (HTTPS), perform the following steps:
1.Run the shell script /usr/bin/gensslcert to create dummy ssl keys for mod_ssl.
This tool copies the /etc/apache2/ssl.crt/ca.crt file to /srv/www/htdocs/CA.crt
and creates the following key files:
•/etc/apache2/ssl.crt/ca.crt
•/etc/apache2/ssl.key/server.key
•/etc/apache2/ssl.crt/server.crt
•/etc/apache2/ssl.csr/server.csr
2.Edit the /etc/sysconfig/apache2 file by adding ssl to the APACHE_MODULES definition
and SSL to the APACHE_SERVER_FLAGS definition.
After completing the edits, the lines should look like the following:
APACHE_MODULES="... ssl ..."
APACHE_SERVER_FLAGS="SSL"
3.Create an SSL virtual host configuration file by copying template file to perform the test:
# cp /etc/apache2/vhosts.d/vhost-ssl.template \
/etc/apache2/vhosts.d/vhost-ssl.conf
4.Restart Apache by entering the following:
# /etc/init.d/apache2 restart
42
Page 43
5.Perform the test by navigating to the website located at:
https://<YOUR_HOSTNAME>
Verify that the certificate is displayed as in Figure 15:
Figure 15 SSL_Enabled Apache
Apache HTTP Server Authorization
The Apache default document root is:
/srv/www/htdocs
A directory named test must exist in the document root directory. In the following sections,
access to the test directory is restricted, and that access to the user directory for TESTNAME
using the password PASSWORD has been granted.
Creating a Test index.html File
Create the following test HTML file:
/srv/www/htdocs/test/index.html
Add the following lines to the preceding file:
<HTML>
<HEAD></HEAD>
<BODY DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm">
<FONT FACE="Times New Roman, serif">
<FONT SIZE=6>The Authentication and Authorization worked !</FONT>
</FONT></P>
</BODY>
</HTML>
Configuring the Authorized Overrides
To authorize overrides, configure the httpd.conf file allow using the following steps:
1.Edit the following file:
/etc/apache2/default-server.conf
2.Find the following data item for the directory /srv/www/htdocs in the preceding file:
AllowOverride None.
3.Modify the value of the data item as follows: AllowOverride AuthConfig.
Installing, Configuring, and Managing Web Server Middleware Stack Components43
Page 44
Creating a Password File
Create a password file to contain the HTTPS server passwords using the following steps:
1.Create the password directory by entering the following command:
# mkdir /etc/apache2/passwd
2.Create and update the user password file by entering the following command:
# htpasswd2 -c /etc/apache2/passwd/mypasswords TESTNAME
New password: <*******>
Re-type new password: *******
Creating the Distributed Configuration File
You can create a distributed configuration file, which you place in a directory, that contains
configuration directives specific to that directory and all its subdirectories. This allows you the
flexibility of defining how your entire directory structure is configured on a per-directory basis.
Use the following procedure to create the .htaccess distributed configuration file:
1.Create the following file:
/srv/www/htdocs/test/.htaccess
2.Add the following lines to the file you created in Step 1:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf/passwd/mypasswords
Require user TESTNAME
Restarting the Apache HTTP Server
Restart Apache by entering the following command:
# /etc/init.d/apache2 restart
Verifying the Authentication and Authorization Operations
Verify that the Apache HTTP server authenticates and authorizes server access properly by
performing the following steps:
1.Open a browser window and navigate to the following website at:
http://<YOUR_WEB_SERVER_IP>/test/
2.When prompted, log in with the user name TESTNAME and the password PASSWORD.
If the login succeeds, the following message appears:
The Authentication and Authorization worked !
If the login fails, the following message appears:
Authorization Required
Protecting Apache HTTP Server Authorization with Symas CDS
Symas CDS is a service that can be used by applications to authenticate users and grant
authorization. It can protect the contents in Apache using an Apache module, mod_auth_ldap,
within the Linux distribution. Another Apache module, mod_ldap, can also be used as part of
the LDAP connection pooling and resulting cache services. When a request for the protected
data arrives, the LDAP directory looks at all entries to find a unique match. If it is found,
mod_auth_ldap uses the domain name (DN) of the entry and the password provided by the
HTTP client to bind the directory server.
44
Configuring CDS and LDAP Services
Use the following procedure to configure the CDS and LDAP services:
Page 45
NOTE:In the steps for this procedure:
rootdnis set to"cn=Manager,dc=example,dc=com"
rootpwis set to secret in the slapd.conf file
1.Create a file named webbase.ldif that contains the following lines:
dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: example
dn: dc=osm,dc=example,dc=com
objectClass: dcObject
objectClass: organizationalUnit
dc: osm
ou: osm
dn: ou=people,dc=osm,dc=example,dc=com
objectClass: organizationalUnit
ou: people
dn: uid=tomy,ou=people,dc=osm,dc=example,dc=com
objectClass: inetOrgPerson
uid: tomy
sn: tom
cn: tom yan
mail:tom.yan@example.com
carLicense:sea4321
userPassword: tom
dn: uid=benw,ou=people,dc=osm,dc=example,dc=com
objectClass: inetOrgPerson
uid: benw
sn: ben
cn:ben won
mail:ben.won@example.com
userPassword: ben
dn: ou=groups,dc=osm,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
<Directory "/var/www/html/ldaptest">
Options Indexes FollowSymLinks
AllowOverride None
order allow,deny
allow from all
AuthType Basic
AuthName Internal
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPURL ldap://<YOUR_LDAP_SERVER_IP>/dc=osm,dc=example,dc=com?uid??(objectclass=*)
require valid-user
AuthLDAPBindDN cn=Manager,dc=example,dc=com
AuthLDAPBindPassword secret
</Directory>
4.Restart Apache by entering the following command:
# /etc/init.d/apache2 restart
5.Verify that the Apache LDAP authentication is operating properly by navigating to the
website located at:
http://<YOUR_WEB_SERVER_IP>/ldaptest/
6.When prompted, log in with the user name tomy and the password tom.
If the login succeeds, the following message appears: .
The Authentication and Authorization worked !
If the login fails, the following message appears:
Authorization Required
Protecting Tomcat Authorization with Symas CDS
Symas CDS can be used by Tomcat web applications to authenticate users and grant authorization.
This section describes how to protect a web application in Tomcat.
46
Page 47
1.Create a web application named myweb in your Tomcat Web server by adding the following
code to the file $CATALINA_HOME/conf/server.xml:
TIP:To apply the following <Realm/> configuration to all of your virtual machines, insert
it between the <Engine/> tags. You can also apply it to the scope of a virtual host by
inserting it between the <Host/> tags because this relies on the content being protected.
8.When prompted, log in with the user name tomy and the password tom.
If the login fails, the following message appears:
Access to the requested resource has been denied.
The tomy user does not belong to the tomcat group so the authentication failed. This failure
proves that the Apache Web server authentication services are operating properly.
This can be verified further by entering the user name benw and password ben. The following
message appears:
Integration of tomcat and CDS succeed!
Monitor Tomcat with OpenView Tomcat SPI
Tomcat is a free, open-source implementation of the Java Servlet and JavaServer Pages technologies
that was developed as part of the Jakarta project from the Apache Software Foundation (ASF).
Tomcat 5 implements the Servlet 2.3 and JavaServer Page 1.2 specifications from Java Software.
It includes many additional features making it a useful platform for developing and deploying
web applications and services. For more information regarding the Tomcat Servlet Engine, see
the Tomcat website as listed in Table 1 (page 12).
HP enhances the OSMS Web Services by using HP OpenView Operations Gallery Smart Plug-Ins
(OVO SPIs). HP OVO is a distributed client/server software solution designed to provide
service-driven event and performance management of business-critical enterprise systems,
applications, and services.
The SPI for Tomcat (Tomcat SPI) provides availability, resource, and process monitoring for the
Tomcat Servlet Engine from one central management console. This software is provided free to
all customers of HP OVO for use under the terms and conditions documented on the download
web page. This SPI provides powerful, centralized tools to monitor and manage the operation
of multiple installations of Tomcat servers.
Tomcat-SPI provides powerful, centralized tools to monitor and manage the operation of multiple
installations of the Tomcat Servlet Engine. The features include the following:
•Monitor availability of Tomcat servers
•Monitor CPU utilization by the server
•Monitor memory utilization by the server
•Monitor processes
48
Page 49
NOTE:The HP OVO Management server runs on either HP-UX or Windows systems. The
examples in this blueprint use HP OVOW.
Figure 16 illustrates the SPIs architecture and OpenView components.
Figure 16 OVOW Architecture
Software Prerequisites and Reference Guides
Before attempting to install the Tomcat SPI, verify that you have a functional HP OVOW 7.5
installation, including an HP OVOW Management Console and the Linux OVO SPI agents for
the Tomcat server. In addition, various OVOW patches are required. Table 2 list these patches:
Table 2 Required OVOW Patches
A.07.31Linux Service Discovery
Support patch
A.07.32OVO Message and Action
Agent patch
A.07.33OVO Message and Action
Agent patch
The SPI installation and configuration documents can be found on the HP OpenView website
at:
http://managementsoftware.hp.com/products/spi/
For information about installing the HP OVOW agent, see the HP OpenView Operations for WindowsInstallation Guide at:
The Tomcat SPI installs the following default components on the HP OVO Management server
and are described in the following sections:
•Tools
•Policies
Monitor Tomcat with OpenView Tomcat SPI49
Page 50
Tools
Table 3 provides an overview of the Tools group in the Tomcat Servlet Engine SPI (SESPI).
Table 3 SE-SPI Applications of the Tool Group
DescriptionServlet Engine SPI
Policies
Configure Tomcat Instrumentation
Creates the SESPI directory and configurations files and libraries required
by the SPI.
Shuts down Tomcat server process.Shutdown Tomcat
Starts the Tomcat server process.Start Tomcat
Stops the log monitor daemons.Start Log Monitor
Stops the log monitor daemons.Stop Log Monitor
Table 4 provides an overview of the Policy group in the Tomcat SESPI:
Table 4 SE SPI Applications of the Policy Group
Measurement
Threshold
Measurement
Threshold
Open Message
Interface
SESPI-Tomcat-CPU Usage
of the Tomcat server.
SESPI-Tomcat-Mmry Usage
usage of the Tomcat
server.
SESPI-Messages
for displaying error
messages from the SPI.
Polling
IntervalDescriptionPolicy NamePolicy Type
Threshold
90%5 minutesMonitorsthe CPU usage
90%5 minutesMonitors the memory
--Provides the interface
Service Auto Discovery
Scheduled Task
SESPI-Tomcat Service
Discovery
SESPI-Tomcat-Monitor
Process
--Provides discovery of
the Tomcat Servlet
engine.
-1 minuteMonitors the Process of
the Tomcat server.
50
Page 51
Appendix A: Checklist for Building a Web Server Middleware Stack
The following checklist is intended to assist you in building a Web Server Middleware Stack in
your environment.
StatusComplete these steps:
Install and verify the Linux installation.1
Configure the basic Apache HTTP Server (page 15).2
Install and configure Sun JDK or BEA JRockit.3
Install and configure Tomcat (page 17).4
5
Implement any advanced Apache HTTP server features—Optional
(page 18).
Integrate the Web Server stack components (page 27).6
a. Configure the Apache Web server and Tomcat connector.
b. Integrate the Apache Web server and PHP.
c. Integrate the Apache Web server and Perl.
d. Integrate the Apache Web server and Python.
Connect Tomcat to a MySQL (page 31) or Oracle Server (page 33).7
a. Download the JDBC drivers.
b. Create a data source.
c. Configure the MySQL or Oracle server.
d. Test the MySQL or Oracle server connectivity
Connect Tomcat to MySQL or Oracle using Hibernate (page 36).8
a. Install Hibernate3, Tomcat, and JDK.
b. Configure MySQL or Oracle drivers in Tomcat.
c. Add test data to the database.
11
d. Create a simple demonstration application in Tomcat.
e. Verify the simple demonstration application operation.
Enable HTTPS support in the Apache HTTP Server (page 42).9
Implement Apache HTTP Server authorization (page 43).10
a. Create a test HTML file.
b. Configure the authorized overrides.
c. Create a password file.
d. Create the distributed configuration file.
e. Restart the server.
f. Verify the authentication and authorization operations.
Implement Apache HTTP Server authorization with Symas CDS
(page 44).
a. Configure CDS and LDAP services.
b. Configure Apache HTTP Server services.
Appendix A: Checklist for Building a Web Server Middleware Stack51
Page 52
StatusComplete these steps:
Implement Tomcat authorization with Symas CDS (page 46).12
Configure Tomcat monitoring with HP OVOW (page 48).13
52
Page 53
Appendix B: Frequently Asked Questions
Q: How do I disable firewall settings?
A: By default, SLES has a firewall enabled. This prevents external systems from accessing ports
below 1024. Enter the following to disable the firewall:
# /sbin/SuSEfirewall2 stop
CAUTION:Disabling the firewall is not advisable. If any external applications need to
communicate with the system, open only those specific ports for outside access rather than fully
disabling the firewall.
Q: How do I open specific ports without disabling the firewall?
A: SLES by default prevents external systems from connecting to any of the reserved port numbers
(0 to 1023). To open a specific port, use one of the following three methods:
Configure with YaST:
To open a specified port using the YaST GUI, perform the following steps:
1.From the YaST Control Center, access the YaST GUI.
2.Select Security and Users Firewall.
From the YaST GUI, you can perform some of the following tasks:
•Configure firewall boot scripts
•Stop the firewall, if it's running
•Save settings to the script /etc/sysconfig/SuSEfirewall2
•Start the firewall with new settings
Configure manually:
To manually open a specified port, perform the following steps:
1.Use the YaST module System Services (runlevel) to enable SuSEfirewall2 in your runlevel
(the setting will most likely be 3 or 5). This sets the symlinks for the SuSEfirewall2_*
scripts to the /etc/init.d/rc?.d/ directories.
2.Modify the /etc/sysconfig/SuSEfirewall2 file. A number of example scenarios can
be found in /usr/share/doc/packages/SuSEfirewall2/EXAMPLES.
For the easiest configuration, you only need to add the TCP ports to FW_SERVICES_EXT_TCP.
For example, the following configuration enables HTTP, SSH and Tomcat services when
the firewall is up:
FW_SERVICE_EXT_TCP="±80 443 22 8080 8443 8009"
3.Test and start the firewall using one of the following SuSEfirewall2_* scripts:
/sbin/SuSEfirewall2 test
/sbin/SuSEfirewall2 start
Configure using the iptables command:
To open a specified port using the iptables command, enter the following::
# iptables -I INPUT -s 0/0 -d 0/0 -p tcp \
--dport <port number> --syn -j ACCEPT
# iptables -save /sbin/SuSEfirewall2 restart
For example:
# iptables -I INPUT -s 0/0 -d 0/0 \-p tcp
--dport 80 --syn -j ACCEPT
# iptables-save /sbin/SuSEfirewall2 restart
Appendix B: Frequently Asked Questions53
Page 54
Appendix C: Vendor Information Reference
This appendix provides references to the vendors that are referenced in the HP OSMS Web Server
stack. These web resources contain a wealth of information and HP encourages you to review
each of them.
Apache HTTP Server Version 2.2
Documentation
Provides all the documentation associated with Version
2.2 of the Apache HTTP server, including Release Notes,
Reference Manual, User's Guide, and Other Topics:
http://httpd.apache.org/docs/2.2
The Apache Tomcat 5.5 Servlet/JSP
Container Documentation Index
PHP DocumentationContains the PHP online documents in multiple languages:
Perl DocumentationContains the core documentation for Perl Version 5.8.8,
Python DocumentationIncludes a documentation index that covers such
Hibernate Getting StartedContains a step-by-step guide that describes Hibernate as
Hibernate FAQsContains the Hibernate FAQs that offers helpful advice
Contains the Apache Tomcat 5.5 Servlet/JSP Container
Introduction, User Guide, Reference, and developer
documents for Java developers who want to contribute to
the Apache Tomcat project:
{ HibernateSessionFactory.closeSession(); }
%>
<body><div align="center"><font size="7">OSMS Hibernate Test Page</font>
<%initSession();%>
</div><h2>1.Retrieve data from table USERS via hibernate<br>
<%showData(out,queryAll());%>
<h2>2.Insert firstname 'Smith',lastname 'Barney' into table USERS
and show the query result via hibernate<br>
<%Long userId=insert();%>
<%showData(out,queryAll());%>
<h2>3.Update lastname of the record which inserted in step 2 to 'root'
and retrieve it via hibernate<br>
<%update(userId);%>
<%showData(out,queryAll());%>
<h2>4.Delete the test data then query again via hibernate<br>
<%delete(userId);%>
<%showData(out,queryAll());%>
<%clean();%>
</body>
</html>
Appendix D: Hibernate Test Application Source Code57
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.