HP 5991-5565 Advanced Apache Http Server Features, Using the Apache Http Server Benchmarking Tool

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:

# ab2 -c 1000 -n 1000 http://<YOUR_WEB_SERVER_IP>/abtest.html

Where:

The value of the -noption sets the number of requests.

The value of the -coption sets the number of concurrency requests.

4.Monitor the access status on the test system by displaying the end of the access log file. To do this, enter the following command:

# tail -f /var/log/apache2/access_log

The system displays messages similar to the following:

10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev" 10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev" 10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev" 10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev" 10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev" 10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"

18

Image 18
Contents HP Open Source Middleware Stacks Blueprint Copyright 2007 Hewlett-Packard Development Company, L.P Table of Contents Monitor Tomcat with OpenView Tomcat SPI Webalizer Usage Report Oracle Database TestPage List of Tables Page Executive Summary HP ServicesIntroduction Intended AudienceUserInput Typographic ConventionsHP Encourages Your Comments Feedback@fc.hp.comHP Open Source Web Server Middleware Stack Web Server Stack ArchitectureWeb Server Stack Architecture Installing and Verifying the Linux Distribution Installing the Linux DistributionRequired Packages and Installation Recommendations Verifying the Linux Distribution Installation YaST Software Selection and System TasksTomcat Configuring the Basic Apache Http ServerInstalling and Configuring Sun JDK on an HP Proliant System # /etc/init.d/apache2 start# ln -s /usr/java/jdk1.5.010 /usr/local/jdk For the alljava.sh file, add the following linesFor the alljava.csh file, add the following lines Following messages appear Installing and Configuring Tomcat# java -version # /usr/local/apache-tomcat/bin/startup.shIf necessary, stop Tomcat by entering the following command Advanced Apache Http Server FeaturesUsing the Apache Http Server Benchmarking Tool # /usr/local/apache-tomcat/bin/shutdown.shApachemodules definition should now look like the following You can correct the error by entering the followingApache Http Server Status and Information Restart the Apache Http Server for the changes take effectApache Server Status web page opens, as shown in Figure Apache Server Information web page opens, as shown in FigureApache Http Server Log # /etc/init.d/apache2 restart# webalizer Using Virtual Host Support For detailed information, see the Webalizer website atCreate the following file Using Apache Http Server URL Redirection Configure virtual hosting by creating a file namedOn the second server, create the following Html file Add the following line to the preceding file Using Apache Http Server Proxy FeaturesEdit the following configuration file Add the following lines to the preceding fileError Responses and Redirects Create the following Html fileUsing Per-User Web Directories Populate the preceding file with the following linesConfiguring the Apache and Tomcat Connector Integrating the Web Server Stack ComponentsInsert the following line below the DocumentRoot line Restart Apache by entering the following commandIf there are any errors, check the following log files Http//YOURHOSTNAME/jsp-examples# rpm -q php5 apache2-modphp5 Integrating the Apache Web Server and PHPIntegrating the Apache Web Server and Perl Create the following test fileConnecting Tomcat to a Database Integrating the Apache Web Server and PythonWeb page displays the following text Connecting Tomcat and MySQL # tar zxf mysql-connector-java-version.tar.gz# ps -efgrep mysqld # mysqladmin -u root -p create osmsdb# $CATALINAHOME/bin/startup.sh # /etc/init.d/mysql startHttp//YOURHOSTNAME8080/mysqltest.jsp Connecting Tomcat and OracleIf needed, start Tomcat by entering the following command Test page opens as shown in FigureTesting the Oracle Database Connectivity Obtaining and Installing the Oracle Jdbc DriverConfiguring the Oracle Server Creating an Oracle Data SourceHttp//YOURHOSTNAME8080/oracleTest.jsp Oracle Database TestConfiguring a Database Driver in Tomcat Connecting Tomcat to MySQL or Oracle Using HibernateInstalling Hibernate, Tomcat, and JDK # mysql -u root -p PasswordFor a MySQL database server Creating a Simple Application in Tomcat# sqlplus osmsusr/osmspass@osmsdbora For an Oracle database serverAsm.jar asm-attrs.jar antlr-2.7.6rc1.jar File HibernateSessionFactory.class is generated Preceding command creates a class file named This directory, create a Hibernate Pojo file namedVerifying the Simple Application Operation Http//YOURHOSTNAME8080/SimpleDemo/hibernate.jspSecure the Web Server Stack Enabling Https Support in the Apache Http ServerRestart Apache by entering the following Verify that the certificate is displayed as in Figure Apache Http Server AuthorizationApache default document root is Create the following test Html fileProtecting Apache Http Server Authorization with Symas CDS If the login fails, the following message appearsConfiguring Apache Http Server Services Protecting Tomcat Authorization with Symas CDS Html HeadHtml Head Monitor Tomcat with OpenView Tomcat SPI # $CATALINA/bin/shutdown.sh # $CATALINA/bin/startup.shSoftware Prerequisites and Reference Guides Tomcat SPI ComponentsTools PoliciesComplete these steps Complete these steps Appendix B Frequently Asked Questions # /sbin/SuSEfirewall2 stopAppendix C Vendor Information Reference Following are the contents of the hibernate.jsp file Appendix D Hibernate Test Application Source CodePage Appendix D Hibernate Test Application Source Code