HP 5991-5565 Using Per-User Web Directories, Populate the preceding file with the following lines

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:

ErrorDocument 404 http://<EXTERNAL_WEB_SERVER_IP>/missing.html

2.Create the following HTML file:

/srv/www/htdocs/missing.html

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

Image 26
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 Required Packages and Installation Recommendations Installing and Verifying the Linux DistributionInstalling the Linux Distribution 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 startFor the alljava.csh file, add the following lines # ln -s /usr/java/jdk1.5.010 /usr/local/jdkFor the alljava.sh 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 Figure# webalizer Apache Http Server Log# /etc/init.d/apache2 restart Create the following file Using Virtual Host SupportFor detailed information, see the Webalizer website at On the second server, create the following Html file Using Apache Http Server URL RedirectionConfigure virtual hosting by creating a file named 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 fileWeb page displays the following text Connecting Tomcat to a DatabaseIntegrating the Apache Web Server and Python 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.jspRestart Apache by entering the following Secure the Web Server StackEnabling Https Support in the Apache Http Server 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