HP 5991-5565 manual Using Apache Http Server Proxy Features, Edit the following configuration file

Page 24

</BODY>

</HTML>

4.Edit the following configuration file:

/etc/apache2/default-server.conf

Add the following line to the preceding file:

Redirect permanent /testdir http://<ANOTHER_WEB_SERVER_IP>/test.html

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"

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:

#ab2 -c 10 -n 10 -X <YOUR_PROXY_SERVER_IP>:80 \

http://<YOUR_WEB_SERVER_IP>/test.html

24

Image 24
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 HP Services IntroductionExecutive Summary Intended AudienceTypographic Conventions HP Encourages Your CommentsUserInput 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 TasksConfiguring the Basic Apache Http Server Installing and Configuring Sun JDK on an HP Proliant SystemTomcat # /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 Installing and Configuring Tomcat # java -versionFollowing messages appear # /usr/local/apache-tomcat/bin/startup.shAdvanced Apache Http Server Features Using the Apache Http Server Benchmarking ToolIf necessary, stop Tomcat by entering the following command # /usr/local/apache-tomcat/bin/shutdown.shYou can correct the error by entering the following Apache Http Server Status and InformationApachemodules definition should now look like the following 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 Using Apache Http Server Proxy Features Edit the following configuration fileAdd the following line to the preceding 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 ComponentsRestart Apache by entering the following command If there are any errors, check the following log filesInsert the following line below the DocumentRoot line Http//YOURHOSTNAME/jsp-examplesIntegrating the Apache Web Server and PHP Integrating the Apache Web Server and Perl# rpm -q php5 apache2-modphp5 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# mysqladmin -u root -p create osmsdb # $CATALINAHOME/bin/startup.sh# ps -efgrep mysqld # /etc/init.d/mysql startConnecting Tomcat and Oracle If needed, start Tomcat by entering the following commandHttp//YOURHOSTNAME8080/mysqltest.jsp Test page opens as shown in FigureObtaining and Installing the Oracle Jdbc Driver Configuring the Oracle ServerTesting the Oracle Database Connectivity Creating an Oracle Data SourceHttp//YOURHOSTNAME8080/oracleTest.jsp Oracle Database TestConnecting Tomcat to MySQL or Oracle Using Hibernate Installing Hibernate, Tomcat, and JDKConfiguring a Database Driver in Tomcat # mysql -u root -p PasswordCreating a Simple Application in Tomcat # sqlplus osmsusr/osmspass@osmsdboraFor a MySQL database server 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 Apache Http Server Authorization Apache default document root isVerify that the certificate is displayed as in Figure 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