Home

HP 5991-5565 User's Manual

image

Contents

1. w secret f webbase ldif Configuring Apache HTTP Server Services Use the following procedure to configure the Apache HTTP server services Installing Configuring and Managing Web Server Middleware Stack Components 45 1 Edit the following file etc apache2 default server conf Add the ldap and authnz_1dap modules to the APACHE MODULES line Once this edit is complete the line should look like the following APACHE MODULES ldap authnz_ ldap 2 Create the following file srv www htdocs ldaptest index html Add the following lines to the preceding file lt HTML gt lt HEAD gt lt title gt Test Apache amp CDS integration lt title gt lt meta http equiv Content Type content text html charset gb2312 gt lt HEAD gt lt BODY gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif SIZE 6 gt The Authentication and Authorization worked lt FONT gt lt P gt lt BODY gt lt HTML gt 3 Edit the following file etc apache2 default server conf Add the following lines to the preceding file lt Directory var www html ldaptest gt Options Indexes FollowSymLinks AllowOverride None order allow deny allow from all AuthType Basic AuthName Internal AuthBasicProvider ldap AuthzLDAPAuthoritative off AuthLDAPURL ldap lt YOUR_LDAP SERVER_IP gt dc osm dc example dc com uid objectclass require valid user AuthLDAPBindDN cn Manager dc example dc com A
2. 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 11 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 Stack 51 52 12 Implement Tomcat authorization with Symas CDS page 46 13 Configure Tomcat monitoring with HP OVOW page 48 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 Lv 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 YaS
3. if sessionFactory null rebuildSessionFactory session sessionFactory null sessionFactory openSession null threadLocal set session public static void rebuildSessionFactory try configuration configure configFile sessionFactory configuration buildSessionFactory catch Exception e System err println Can not create SessionFactory e printStackTrace public static void closeSession throws HibernateException Session session Session threadLocal get threadLocal set null if session null session close return session public static org hibernate SessionFactory getSessionFactory return sessionFactory public static void setConfigFile String configFile HibernateSessionFactory configFile configFile sessionFactory null The following are the contents of the hibernate jsp file lt page language java import java util org hibernate HibernateException org hibernate Query org hibernate Transaction com hp osms hibernate utility HibernateSessionFactory com hp osms hibernate Users pageEncoding ISO 8859 1 gt lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html gt lt head gt lt title gt Simple Hibernate test Page lt title gt lt meta http equiv pragma content no cache gt lt meta http equiv cache control content no cache gt lt meta http equiv expires content 0 gt
4. Some ofthe modules available on CPAN can be found in the perl series Check Autocheck Cancel Accept 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 14 rpm q apache2 apache2 prefork apache2 mod perl apache2 mod python apache2 mod php5 webalizer If any of these packages are not installed locate the RPM package on the Linux distribution media and install the missing package A 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 instal
5. lt IfModule gt 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 Components 19 20 Verify that the etc apache2 sysconfig d loadmodule conf file contains the following lines LoadModule info module usr lib64 apache2 prefork mod_info so LoadModule status_module usr 1ib64 apache2 prefork mod_status so 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 lt YOUR_WEB_SERVER_IP gt server status The Apache Server Status web page opens as shown in Figure 6 Figure 6 Apache Server Status Apache Server Status for bl35p 16 test Server Version Apache 2 2 0 Lin SUSE Server Built Jun 16 2006 18 01 14 Current Time Saturday 03 Feb 2007 13 01 04 EST Restart Time Saturday 03 Feb 2007 12 57 47 EST Parent Server Generation 0 Ser
6. lt head gt lt 3 Appendix D Hibernate Test Application Source Code 55 public void showData JspWriter out List list Iterator it list iterator try out print lt table width 100 border 1 cellspacing 0 cellpadding 0 gt lt tr gt out print lt tr gt lt td bgcolor E2E6F1 gt lt div align center gt UserID lt br gt lt div gt lt td gt out print lt td bgcolor E2E6F1 gt lt div align center gt FirstName lt br gt lt div gt lt td gt out print lt td bgcolor E2E6F1 gt lt div align center gt LastName lt br gt lt div gt lt td gt lt tr gt while it hasNext Users users Users it next out print lt tr gt lt td gt lt div align center gt s users getUserId c lt br gt lt div gt lt td gt out print lt td gt lt div align center gt users getFirstName lt br gt lt div gt lt tds out print lt td gt lt div align center gt users getLastName lt br gt lt div gt lt td gt lt tr gt out print lt tr gt lt table gt catch Exception e e printStackTrace S gt lt 3 org hibernate Session hbsession null void initSession hbsession HibernateSessionFactory getSession public List queryAll query table users from database List list null try String hsql from Users org hibernate Query query hbsession createQuery hsql list query list return list cat
7. lt ANOTHER_WEB_SERVER_IP gt test html Use the following command to restart your Apache HTTP server for the preceding changes to take effect etc init d apache2 restart Verify that the URL redirect configuration is correct by opening a browser and entering the following website http lt YOUR_ WEB SERVER IP gt testdir The following message appears The URL redirect is successful Using Apache HTTP Server Proxy Features 24 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 2 Start the Apache HTTP server on the first system 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 On the second system which acts as the Apache Prox
8. Database TeSticcscesc vcdessevesodevssseacedovgebdeves saa ns voveud2eeeb sede ava y babe b ead davouebade eu A abodes 35 Verifying the Simple Application Config uratiomin ccccsasisccadesvieersseeesestnevueersnstsevaderesdavegsvieeanenandees 41 Sols Enabled AAI ssivcsiieis Sea s acet posts sany vayd ocak va 82 Men nea eeu Sad Soa wae dona lash ead neh Se Sea ei 43 OV OW E SIT E E E S t LE AET E TASE A A ETIE E se eas ae ad Vea a at T 49 List of Tables 1 Software Test Configuratio issiria pea E nada alate ae aed 12 2 Required OV OW Patches asss nocni eiin ined Zany wad a sayy ned Sean s Oda va cee atv ath enw es 49 3 SE SEL Applications of the Tool Csr pis wsisccsviaistec usa esis yay ea aiicsualczcagisalotes as ete eed wav tua REKEN eari EER iseina 50 4 SE SPI Applications of the Policy Grou piswsszivsyasnscovaesd easy anteciee atceupy hen degusesdtenpantodcrtealeeenrdeniesneeds 50 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 appli
9. disk partitions that are 2 full or nearly full can S Details dearade system b Cancel Accept 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 Inthe 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 File Package Extras Help Filter Package Groups m Package Summary Size Version Source 7 perl The Perl interpreter 43 3M 5 8 8 14 2 Package Groups Amusements Development Languages Cand C Java Other i Python Scheme Tel Libraries Sources Tools Documentation py perl 32bit The Perl interpreter 8 8M 5 8 8 14 2 Hardware Productivity Programming System z All Description Technical Data Dependencies Versions perl The Perl interpreter perl Practical Extraction and Report Language Perl is optimized for scanning arbitrary text files extracting information from those text files and printing reports based on that information It is also good for many system Name Disk Usage Used Free Total_ management tasks Peri is intended to be practical easy to use efficient and 1 133 1 9 GB 54 0 GB 55 9 GB complete rather than beautiful tiny elegant and minimal
10. www websitel com www website2 com 3 Verify that both websites resolve to the same IP address by entering the following commands ping www websitel com ping www website2 com 4 Create the following two directories srv www htdocs websitel srv www htdocs website2 5 Create the following file srv www htdocs websitel index html 6 Populate the file that you created in Step 5 with the following lines lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt This is www websitel com lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt 7 Create the following file srv www htdocs website2 index html1 10 11 Populate the file that you created in Step 7 with the following lines lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt This is www website2 com lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt Configure virtual hosting by creating a file named etc apache2 vhosts d vhosts conf and adding the following lines NameVirtualHost 80 lt VirtualHost 80 gt DocumentRoot srv www htdocs websitel ServerName www websitel com lt VirtualHost gt lt VirtualHost 80 gt DocumentRoot srv www htdocs website2 ServerName www website
11. E iae 9 HP SeryiceS oera couteszeassocciah ects EEE ea Aa EEE DE E PEA ER AREE AAE EEDE De PEATE nabs C TEE e AE TEEDE PERA eae 9 Typogtaphic Convention Sisiane ins ir aaee a an aeea E A AE R E EES 10 HP Encourages Your Comments sinri eesse seinni enata ir eeu en oesi veesi e iiaee aiia 10 HP Open Source Web Server Middleware Stack cn icevcewen ced ieleecatteeicnerocth tu deielencnetaiiets 11 Web Server Stack ArchiteCture ccccccccccccsssessnsececeeecessesennncececeeecsenesnaaececeescseseseaaaececeeeseseesenaeaeeees 11 Installing and Verifying the Linux Distribution coi sts ieeetiset col wtaneraeetn sean ease seinesemencnonen tie 13 Tostaling the Linux Disttib ution sirsiran iren n in e nE i ei a K a EEEa tage 13 Required Packages and Installation Recommendations s sesssesssessessesssersrrseessersreseesserssesees 13 Verifying the Linux Distribution Installation wis cccadecrattesconcsabens ncen dcisshbaiiey anes cnvveatecenpnaetdegrneys 14 Installing Configuring and Managing Web Server Middleware Stack Components 0 00008 15 Configuring the Basic Apache HTTP Servet i amine satiate eerie Grane 15 Installing and Configuring Sun JDK on an HP Proliant System 0ccceceeeeeeeeese cess eee eeeeeeeeeees 15 Installing and Configuring Tomato tccncdvnaiaziusy cen icoused sexs snvedeedeenseury ten nagtned beayannvdeoteaieeies sbenbealenets 17 Advanced Apache HTTP Server Peat res cisentaveesiivetiaeeueostuenevtaanevssss
12. New Data Source To create a data source binding for a JDBC driver perform the following steps on the Tomcat web server Installing Configuring and Managing Web Server Middleware Stack Components 31 32 Create a data source descriptor file named CATALINA_HOME conf context xml and insert the following lines lt Context gt lt Resource name jdbc mysqlDB auth Container type javax sql DataSource driverClassName com mysql jdbc Driver url jdbc mysql lt IP_OR_NAME OF MYSQL SERVER gt 3306 lt DATABASE NAME gt username lt DB_ USERNAME gt password lt DB_PASSWORD gt maxActive 10 maxIdle 10 maxWait 1 gt lt Context gt For example lt Resource name jdbc mysqlDB auth Container type jJavax sql DataSource driverClassName com mysql jdbc Driver url jdbe mysql 191 168 1 100 3306 osmsdb username osmsusr password osmspass maxActive 10 maxIdle 10 maxWait 1 gt 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 If the database used in the Tomcat data source does not exi
13. dc com roleName cn roleSearch uniqueMember 0 gt Next avoid a conflict by commenting out the Tomcat default authentication setting lines as follows Sa lt Realm className org apache catalina realm UserDatabaseRealm resourceName UserDatabase gt FFS Edit the CATALINA_HOME webapps myweb WEB INF web xml application file and add the following lines lt xml version 1 0 encoding ISO 8859 1 gt lt web app xmlns http java sun com xml ns j2ee xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http java sun com xml ns j2ee http java sun com xml ns j2ee web app 2 4 xsd version 2 4 gt lt security constraint gt lt display name gt Example Security Constraint lt display name gt lt web resource collection gt lt web resource name gt Protected Area lt web resource name gt lt url pattern gt lt url pattern gt lt http method gt GET lt http method gt lt http method gt PUT lt http method gt lt http method gt POST lt http method gt lt web resource collection gt lt auth constraint gt lt role name gt tomcat lt role name gt lt auth constraint gt lt security constraint gt lt login config gt lt auth methods gt BASIC lt auth methods lt realm name gt Single Sign on Example lt realm name gt lt login config gt lt security role gt lt role name gt tomcat lt role name gt lt security role gt lt web app gt Create a file nam
14. 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 lines LogFile var log apache2 access_log OutputDir srv www htdocs webalizer 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 b135p 16 Reading history file webalizer hist Generating report for February 2007 Generating summary report Saving history inf
15. in the CATALINA_HOME conf context xml file by entering the following commands sqlplus as sysdba SQL gt create user osmsusr identified by osmspass SQL gt grant connect resource to osmsusr Testing the Oracle Database Connectivity Test the connectivity between the Tomcat server and the Oracle database by performing the following steps on the Tomcat Web server 34 Create a JSP file named CATALINA_HOME webapps ROOT oracleTest jsp and insert the following lines lt page contentType text html import java io java sql javax sql javax naming gt lt html gt lt head gt lt title gt Tomcat gt Oracle Test lt title gt lt link rel stylesheet href style _master css type text css gt lt meta http equiv cache control content no cache gt lt head gt lt body gt lt InitialContext ctx new InitialContext DatabaseMetaData dm null DataSource ds DataSource ctx lookup java comp env jdbc oracleDB Connection conn null Statement stmt null try conn ds getConnection dm conn getMetaData out printlin Connected to gt database version dm getDatabaseProductVersion catch Exception sqlex out printin sqlex getMessage inally conn close o gt lt body gt lt html gt If the Tomcat Web server is not running start it by entering the following command S CATALINA HOME bin startup sh Verify that the Oracle test page is displayed
16. lebshocctas ye decked spvadesgeadencasneuiar tyeauseanspeebecdyeiedehey 44 Verifying the Authentication and Authorization Operations cccccceceesseessecessceeeeeeeee 44 Protecting Apache HTTP Server Authorization with Symas CDS cccccecseseeseesesesetneeeeees 44 Configuring Cho amd LOAP Ser vicese sfc cositerrsesiveeh ina eara Err EAA 44 Configuring Apache HTTP Server Services sesssessessesssersersessersseseessersseeseeseensesnreneense 45 Protecting Tomcat Authorization with Symas CDS ssesssesssssessessssetsssseseesessesresssseesesseseees 46 Monitor Tomcat with OpenView Tomcat SPE sic soss scssesscenstess nce ccesnewtedets onctectastessats ng ineiauttecete swsnedizeseens 48 Software Prerequisites and Reference Giles x toi deicc csi caeerhentctunicle seas ie eneibe Lie ean ivaaatien 49 Tomcat SPC OMmPONents srice ani E eer San eorenediet pease alee EO EEOAE NR 49 TOONS atte Peas oheee a ar a ae acter eis ade at Nee oced an teak Met rN So ele ae read a dct edo teed fet 50 POV CIOS io Poses ee Seaala ics Paces oo Sele shee a eae de eases Cow vets See se Tove Sede Des EAA Seb deee does dandesece ook teteeare 50 Appendix A Checklist for Building a Web Server Middleware Stack cccecceecessecessceeseeeeeeeees 51 Appendix B Frequently Asked Ouest siiscssssck tans eidictunn ip igi Meera ictantigniledaiaaeaasales 53 Appendix C Vendor Information Reference gcc iiss cos seseccdes eeeesb tans gasasintetgnedepcadervike
17. mysql gt Last name varchar 30 not null mysql gt Add a user named osmsusr that uses the password osmspass and grant the appropriate privileges to it by entering the following commands mysql gt create user osmsusr mysql gt grant all on osmsdb to osmsusr identified by osmspass Add test data to the Oracle database using the following steps 36 A Log in to Oracle using the user name osmsusr and password osmspass by entering the following command sqlplus osmsusr osmspass osmsdb ora 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 gt Create sequence hibernate sequence start with 10 increment by 1 min value 10 maxvalue 999999999999 SQL gt Create table USERS user_id number 10 not null first name varchar 30 not null last name varchar2 30 not null SQL gt 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 cr
18. name DN of the entry and the password provided by the HTTP client to bind the directory server Configuring CDS and LDAP Services Use the following procedure to configure the CDS and LDAP services A NOTE In the steps for this procedure rootdn issetto cn Manager dc example dc com rootpw issetto secret in the slapd conf file le Create a file named webbase 1dif 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 dn cn tomcat ou groups dc osm dc example dc com objectClass groupOfUniqueNames cn tomcat uniqueMember uid benw ou people dc osm dc example dc com Add these records into the directory using the 1dapadd command by entering the following command opt symas bin ldapadd x D cn Manager dc example dc com
19. navigating to the website http lt YOUR_HOSTNAME gt jsp examples Figure 10 show an example of the JSP Examples page Figure 10 JSP Examples Page to Test mod_jk c ore eee ded dede vy wd vy If there are any errors check the following log files var log apache2 error_log var log apache2 access_log var log apache2 mod_jk log Integrating the Apache Web Server and PHP 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 E Verify that PHP is installed by entering the following command rpm q php5 apache2 mod php5 Create the following test file srv www htdocs test php Add the following lines to the preceding file lt test php phpinfo gt Verify that PHP works by opening a browser and navigating to the following website http lt YOUR_HOSTNAME gt test php A web page containing the PHP version and license numbers is displayed Integrating the Apache Web Server and Perl The apache2 mod_per1 module integrates a Perl interpreter into the Apache Web server allowing you to use Perl when creating web applications Use the apache2 mod_per1 module provided by the Linux distribution To test the installation perform the following steps 1 Verify that the apache2 mod_per1 module is installed by entering the following co
20. stputccannessaptieeeveanaees cov cheelideunecs 18 Using the Apache HTTP Server Benchmarking TOO ccisti sti iteuittanctitcer ee tis iivdets teas coarseixeeiantes 18 Apache HTTP Server Status and Information sisssinadesseecsessusecvasasacensberdnna sesnontoad ts oengcusa venotaadeeds 19 Configuring and Using the Mod Ules aie socteccre sevasecvevehsveds vie ad tavelasee ents Cie chinese setiatotonsaaete 19 Apache HTTP Servier LOS oie teetin EEA ne E a gua eunerobas S aaaea T 21 Using the Error Log to Diagnose the Apache HTTP Server aictuscnecdin dries 21 Using Webalizer to Perform Apache HTTP Server Log AnalySis cccccccccceseeseeseeteeees 21 Using Virtual Host SUpport cits vsieec cuss Sexes viaaak cashes cc aS aE E Ose eo ieee shou ESE EEEREN Sve eel heb ted 22 Using Apache HTTP Server URE Redirect Ofiiats cccracnclsaradren elagecitentee arate 23 Using Apache HTTP Servet Proxy PCAtutes amp x22 sa sine tawwheertssvepasdb ue ieii iesirea 24 Error Responses anid Rediteetsacac ci och Aina tere hae aaa yn ea aan 25 Customizing Plain Text RESP OMSCS sco iier icon cnn versie dus seca vena cre dabesd ceatanvacPesseOet ent a etiwnditets 25 Customizing Local URL Redirect Responsesicn cate tachoiene irene reuiirudew axa aie 25 Customizing External URL Redirect Responses ssssessssessessesesersesresserttstssestesessessenserees 26 Using Per User Web Directories ednine i aE tat eh ero aeaiia 26 Integrating the Web Server Stack Components ccis
21. 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 18 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 lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The page is used for Apache benchmarking test lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt 3 Performa concurrency request to the test system by logging into another s
22. 2 com lt VirtualHost gt Restart your Apache HTTP server for the changes to take effect Verify that the virtual hosting configuration operates properly by opening a browser and entering the following website www websitel com The following message appears This is www websitel 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 On the second server create the following HTML file srv www htdocs test html Add the following lines to the file you created in Step 2 lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The URL redirect is successful lt FONT gt lt FONT gt lt P gt Installing Configuring and Managing Web Server Middleware Stack Components 23 lt BODY gt lt HTML gt Edit the following configuration file etc apache2 default server conf Add the following line to the preceding file Redirect permanent testdir http
23. ER IP gt 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 lt EXTERNAL WEB_SERVER_IP gt missing html Create the following HTML file srv www htdocs missing html Populate the preceding file with the following lines lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The page you request does not exist External redirects example lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt Verify the custom external URL redirect message by opening a browser and entering the following website http lt YOUR_WEB_SERVER_IP gt non exist The following message appears The page yo
24. Figure 13 by opening a browser and navigating to the following website http lt YOUR_HOSTNAME gt 8080 oracleTest jsp Figure 13 Oracle Database Test Tomcat Oracle Test Mozilla Firefox TER File Edit View History Bookmarks Tools Help E D S amp G Aer 10 101 0 12 8080 oractetest jsp v D G c01 F Tomcat gt Oracle Test B Connected to gt database versionOracle Database 10g Enterprise Edition Release 10 2 0 1 0 Production With the Partitioning OLAP and Data Mining options Installing Configuring and Managing Web Server Middleware Stack Components 35 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 applicat
25. HP Open Source Middleware Stacks Blueprint Web Server on HP ProLiant Servers with SUSE Linux Enterprise Server Version 10 Haase r 5991 5565 bles A st 2007 h Edition if invent Copyright 2007 Hewlett Packard Development Company L P Legal Notice Confidential computer software Valid license from HP required for possession use or copying Consistent with FAR 12 211 and 12 212 Commercial Computer Software Computer Software Documentation and Technical Data for Commercial Items are licensed to the U S Government under vendor s standard commercial license The information contained herein is subject to change without notice The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services Nothing herein should be construed as constituting an additional warranty HP shall not be liable for technical or editorial errors or omissions contained herein Acknowledgments Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries Java is a US trademark of Sun Microsystems Inc Table of Contents Iglu yore korea lo nmearrerecenc nr naren cere tierra E Terres terry brrcerer sertrre A eer ere revestrers 9 Executive S mmiary seieren eN r E EEE EE a eet ee ote a Maa 9 Intended AtiGienice E E E E E A 9 Scope and PUTpOSE iseis triene ii aT o EE eer E Er E ATE aap ETEEN ET EE TA
26. 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 Distribution 13 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 This dialog allows you RB Software Selection and System Tasks to define this system s tasks and what software to install Available tasks and software for this p Server Base Syst
27. T Control Center access the YaST GUI 2 Select Security and Users Firewall From the YaST GUI you can perform some of the following tasks e Configure firewall boot scripts e Stop the firewall if it s running e Save settings to the script etc sysconfig SuSEfirewall2 e 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 SuSEfirewal12 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 480 443 22 8080 8443 8009 3 Test and start the firewall using one of the following SuSEfirewal12_ 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 tep dport lt port number gt syn j ACCEPT iptables save sbin SuSEfirewall2 restart For example iptables I INPUT s 0 0 d 0 0 p tcp dpor
28. awektqasaperties weecbey 54 Appendix D Hibernate Test Application Source COdG csigsce tesrectivttedtte glee cat ere aieeee aie twee tiacteors 55 Table of Contents List of Figures OC OANDTFWNH Web Server Stack ArchitecCture ccccccccessscecccececesceseseececcceceaueaesesceceseseaueaeasceceseseasaaenseeceeeeeaeaaea 12 Web Server Hardware EnvirOnme nt 0 cccccccccccssscccccessccsscessccsseeseccsseuusecsscesccsseuuscesseuesesseuunsess 13 YaST Software Selection and System Tasks jcc ci vie hi das etal uscacn gate svete udu ets 14 SUSE Installation Settings acces inesgchagscteddnesnabvay ETE unde beng NEE EENET EENE ESERE NTE E RTE 14 Tomcat Successful Installation Verification ccccccccccccceceeseseseececccececeaueseececcceceseaaeaseeceeeeeaeaaes 17 Apache Server Status ia ies naen E aa E e E EE EA O E rE E EEEE E E 20 Apache Server Informatio Nemisis enea eea ea eea anie E AARET vase sn E SA eE E A VEAST ove dein NENE a 20 Webalizer Usage Reportiiniturret enraiar aa E E E A E E TA e aS iaa 22 Connecting the Apache Web Server and Tomcat Web Containe cccccccesceeseeessessseesseeeseeees 27 JSP Bxam ples Page to Test Mod pki ris ois prenesie enaner AEAEE A E E Ea E i 28 Tomcat Connections Using DBC ss les seu eectessectennez ne snesiartedits eeotent onan eeni iiias a iii 31 Tomcat Connecting MySQL Test Pace 5 acs 7 saat cashacessaeceeilens dan eevestvseds Guo veaeie ne tuserk don wevnsnetice gerne daite 33 Oracle
29. base version dm getDatabaseProductVersion catch Exception sqlex out println sqlex getMessage finally conn close o gt lt body gt lt html gt 2 If needed start Tomcat by entering the following command S CATALINA HOME bin startup sh 3 Verify Tomcat is connecting to MySQL by opening a browser and navigating to the following website http lt YOUR_HOSTNAME gt 8080 mysqltest jsp The test page opens as shown in Figure 12 Figure 12 Tomcat Connecting MySQL Test Page Tomcat gt MySQL Test Mozilla Firefox Eile dit Yiew Higtory Bookmarks Jools felp h fj https 10 101 0 12 8080 aysqltest jap F Tomecat gt MySQL Test G 28 Connected to gt database version 0 40 enterprise gpl 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 Components 33 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 th
30. bled Apache Website Certified by an Unknown Authority f Unable to verify the identity of bl35p 16 test as a trusted site Possible reasons for this error Your browser does not recognize the Certificate Authority that issued the site s certificate The site s certificate is incomplete due to a server misconfiguration You are commected to a site pretending to be bi3Sp 16 test possibly to obtain your Confidential information Please notify the site s webmaster about this problem Before accepting this certificate you should examine this site s certificate carefully Are you wiling to to accept this certificate for the purpose of identifying the Web site biSe 16 test Examine Certificate Accept this certificate permanently Accept this certificate temporarily for this session Do not accept this certificate and do not cornect to this Web site 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 lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin b
31. cations 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 A 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 Suppo
32. ce 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 LDAP LDAPS 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 http dev mysql com downloads connector j 5 0 html 2 Unzip the downloaded packages by entering the following command tar zxf mysql connector java lt version gt tar gz 3 Install the JDBC driver for Tomcat by entering the following command cp mysql connector java lt version gt jar CATALINA HOME common 1lib Creating a
33. ch HibernateException he he printStackTrace return list public Long insert try Transaction tx hbsession beginTransaction Users users new Users users setFirstName Smith users setLastName Barney hbsession save users hbsession flush tx commit return users getUserId catch HibernateException he he printStackTrace return null public void update Long userID try Transaction tx hbsession beginTransaction Users users Users hbsession get Users class userID users setLastName root hbsession save users hbsession flush tx commit catch HibernateException he he printStackTrace public void delete Long userID try Transaction tx hbsession beginTransaction String hsql delete Users where user_id userID Query query hbsession createQuery hsql query executeUpdate tx commit catch HibernateException he he printStackTrace public void clean HibernateSessionFactory closeSession o o gt lt body gt lt div align center gt lt font size 7 gt 0SMS Hibernate Test Page lt font gt lt initSession gt lt div gt lt h251 Retrieve data from table USERS via hibernate lt br gt lt sshowData out queryAll1 gt lt h2 gt 2 Insert firstname Smith lastname Barney into table USERS and show the query result via hibernate lt br gt lt Long userId ins
34. d 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 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 lt IfModule mod_status c gt lt Location server status gt SetHandler server status Order deny allow Deny from all Allow from YOUR_WEB_ BROWSER_IP lt Location gt lt IfModule gt 2 Edit the etc apache2 mod_info conf file and add the following lines lt IfModule mod_info c gt lt Location server info gt SetHandler server info Order deny allow Deny from all Allow from YOUR_WEB BROWSER_IP lt Location gt
35. e Oracle website at http www oracle com technology software tech java sqlj_jdbc index html A NOTE For the Oracle JDBC driver with JDK 1 4 and 1 5 use the ojdbc14 jar file 2 Copy the JDBC driver to the Tomcat environment by entering the following command cp ojdbcl4 jar CATALINA HOME common 1ib Creating an Oracle Data Source To create a data source binding for the Oracle JDBC driver data source perform the following on the Tomcat Web server Create a file named CATALINA_HOME conf context xml and insert the following lines lt Context gt lt Resource name jdbc oracleDB type javax sql DataSource password lt DB_PASSWORD gt driverClassName oracle jdbc driver OracleDriver maxIdle 2 maxWait 5000 username lt DB_USERNAME gt url jdbc oracle thin lt IP_OR_NAME OF ORACLE SERVER gt 1521 lt ORACLE SID gt maxActive 4 gt lt Context gt For example lt Resource name jdbc oracleDB type javax sql DataSource password osmspass driverClassName oracle jdbc driver OracleDriver maxIdle 2 maxWait 5000 username osmsusr url jdbc oracle thin 192 168 1 100 1521 OSMSDB maxActive 4 gt Configuring the Oracle Server Perform the following steps on the Oracle Database server 1 Verify that the Oracle server and the listener are running by entering the following command Isnrctl status 2 Create a database user and grant the proper privileges which should be the same as the user
36. e server name or IP address Add the Hibernate3 JAR files to the application library by copying the following files from the Hibernate3 installation directory to SCATALINA HOME webapps SimpleDemo WEB INF 1ib hibernate3 jar dom4j 1 6 1 jar cglig 2 1 3 jar commons logging 1 0 4 jar commons collections 2 1 1 jar ehcache 1 1 jar asm jar asm attrs jar antlr 2 7 6rcel jar Hibernate uses a configuration file named hibernate cfg xml to obtain the database connection information and mapping file information Create a Hibernate configuration file named SCATALINA HOME webapps SimpleDemo WEB INF classes hibernate cfg xml Add the following lines depending on whether your database is MySQL or Oracle For a MySQL database server lt xml version 1 0 encoding UTF 8 gt lt DOCTYPE hibernate configuration PUBLIC _ Hibernate Hibernate Configuration DTD 3 0 EN http hibernate sourceforge net hibernate configuration 3 0 dtd gt lt hibernate configuration gt lt session factory gt lt property name show_sql gt true lt property gt lt property name connection datasource gt java comp env MySqlDS lt property gt lt property name dialect gt org hibernate dialect MySQLDialect lt property gt lt mapping resource com hp osms hibernate Users hbm xml gt lt session factory gt lt hibernate configuration gt For an Oracle database server lt xml version 1 0 encoding UTF 8 gt lt DOCTYPE hibernate config
37. eate a simple application in Tomcat 1 Create a directory named CATALINA_HOME webapps SimpleDemo that contains the appropriate subdirectories by entering the following commands mkdir SCATALINA HOME webapps SimpleDemo mkdir CATALINA HOME webapps SimpleDemo META INF mkdir SCATALINA HOME webapps SimpleDemo WEB INF mkdir S CATALINA HOME webapps SimpleDemo WEB INF classes mkdir SCATALINA HOME webapps SimpleDemo WEB INF 1lib Configure the MySQL or Oracle data source by creating a file named SCATALINA_HOME conf Catalina localhost SimpleDemo xml Add the following lines depending on whether your database is MySQL or Oracle For a MySQL database server lt Context gt lt Resource name MySqlDS type jJavax sql DataSource password osmspass driverClassName com mysql jdbc Driver maxIdle 10 maxWait 5000 username osmsusr url jdbc mysql IP_OR_ HOSTNAME OF DB SERVER 3306 osmsdb maxActive 15 gt lt Context gt For an Oracle database server lt Context gt lt Resource name OracleDS type jJavax sql DataSource password osmspass driverClassName oracle jdbc driver OracleDriver maxIdle 10 Installing Configuring and Managing Web Server Middleware Stack Components 37 38 A maxWait 5000 username osmsusr url jdbc oracle thin IP_OR_ HOSTNAME OF DB SERVER 1521 osmsdb_ora maxActive 15 gt lt Context gt Where IP_OR_HOSTNAME OF _DB_SERVERis the MySQL or Oracle databas
38. ed CATALINA_HOME webapps myweb index html and add the following lines lt HTML gt lt HEAD gt lt TITLE gt Test Tomcat amp CDS integration lt TITLE gt lt meta http equiv Content Type content text html charset gb2312 gt lt HEAD gt lt BODY gt Installing Configuring and Managing Web Server Middleware Stack Components 47 lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif SIZE 6 gt Integration of tomcat and CDS succeed lt FONT gt lt P gt lt BODY gt lt HTML gt 5 Configure the directory service as described in Configuring CDS and LDAP Services page 44 6 Restart Tomcat by entering the following commands SCATALINA bin shutdown sh SCATALINA bin startup sh 7 Verify that the Tomcat LDAP authentication is operating properly by navigating to the following website http lt YOUR_TOMCAT SERVER _IP gt port lt YOUR_APPLICATION NAME gt For example http 10 101 1 26 8080 myweb index html 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 o
39. em Web and LAMP Server system are shown by Common Code Base category in the left WE Novell AppArmor column To view a description for an High Availability Set up a Web server that is able to serve static dynamic and item select it in the pM 32Bit Runtime Environment interactive content like a Web shop Itis based on the list Graphical Environments Apache HTTP Server the database management system MySQL and a scripting language such as PHP Python Ruby Change the status of Diy GNOME Desktop Environment for S on Rails or Per an item by clicking its KDE Desktop Environment for Server status icon or pW X Window System ranecickany icon ter iPHimalry Fletions lll a context menu With File Server the context menu you can also change the ph Print Server status of all items Mail and News Server Web and LAMP Server Details opens the detailed software Internet Gateway package selection DHCP and DNS Server where you can view Directory Server LDAP and select individual softwersteackeges SAP Application Server Base Oracle Server Base Xen Virtual Machine Host Server The Disk Usage display in the lower J right comer showsthe Web Based Enterprise Management Name Disk Usage Used Free Total remaining disk space 3 1 9 GB 54 0 GB 55 9 GB after all requested C C Compiler and Tools changes will have been performed Hard
40. ert gt lt sshowData out queryAll gt lt h2 gt 3 Update lastname of the record which inserted in step 2 to root and retrieve it via hibernate lt br gt lt Supdate userId gt lt sshowData out queryAll gt lt h2 gt 4 Delete the test data then query again via hibernate lt br gt lt delete userId gt lt sshowData out queryAll1 gt lt clean gt lt body gt lt html gt Appendix D Hibernate Test Application Source Code 57
41. f 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 followin
42. g e Monitor availability of Tomcat servers e Monitor CPU utilization by the server e Monitor memory utilization by the server e Monitor processes 48 A 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 OVOW Architecture Console SPI for OSM Managed Nodes Management Server 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 Patch Description Version Patch Name Dependencies Linux Service Discovery A 07 31 Ovow_00198 OVOW_00187 Support patch OVO Message and Action A 07 32 OVOW_00213 OVOW_00166 Agent patch OVO Message and Action A 07 33 OVOW_00234 None 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 Windows Installation Guide at http ovweb external hp com ovnsmdps pdf ovow75_install pdf Tomcat SPI Components The Tomcat SPI instal
43. how to use Hibernate to insert data into the database org hibernate Session hbsession HibernateSessionFactory getSession try Transaction tx hbsession beginTransaction Users users new Users users setFirstName Smith users setLastName Barney hbsession save users hbsession flush tx commit catch HibernateException he he printStackTrace finally if hbsession null1 HibernateSessionFactory closeSession EY 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 http lt YOUR_HOSTNAME gt 8080 SimpleDemo hibernate jsp The OSMS Hibernate Test web page is displayed as shown in Figure 14 Figure 14 Verifying the Simple Application Configuration OSMS llibernate Test Page 1 Retrieve data trom table USILKS via hibernate lasip Listare Iast ame inseri firstoume Smith lastoume Barney into table USERS and show the query result via hibernate Us TitstName Lastvarm 152 Sih Dariy 3 Update lastname of the record which inserted in step 2 t
44. ibernate POJO file named SCATALINA 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 userlId 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 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 javac Users java The preceding command creates a class file named SCATALINA HOME webapps SimpleDemo WEB INF classes com hp osms hibernate Users class Test Hibernate functionality such as inserting updating deleting and retrieving data from the database by creating a sample JSP file named SCATALINA HOME webapps SimpleDemo hibernate jsp The following code fragment from hibernate jsp shows
45. iguration configuration new Configuration private static org hibernate SessionFactory sessionFactory private static String configFile CONFIG FILE LOCATION private HibernateSessionFactory public static Session getSession throws HibernateException Session session Session threadLocal get if session null session isOpen if sessionFactory null rebuildSessionFactory session sessionFactory null sessionFactory openSession null threadLocal set session return session public static void rebuildSessionFactory try configuration configure configFile sessionFactory configuration buildSessionFactory catch Exception e System err printin Can not create SessionFactory e printStackTrace public static void closeSession throws HibernateException Session session Session threadLocal get threadLocal set null if session null session close public static org hibernate SessionFactory getSessionFactory return sessionFactory public static void setConfigFile String configFile HibernateSessionFactory configFile configFile sessionFactory null Compile the HibernateSessionFactory java file by entering the following commands cd CATALINA HOME webapps SimpleDemo WEB INF classes com hp osms hibernate utility javac cp S CATALINA HOME webapps SimpleDemo WEB INF 1ib hibernate3 jar Hibe
46. ions 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 lt VERSION gt jarorojdbc14 jar are configured go to the SCATALINA_HOME common 1ib 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 lt PASSWORD gt Create a database named osmsdb and create a table named USERS by entering the following commands mysql gt create database osmsdb mysql gt use osmsdb mysql gt create table USERS mysql gt User_id int 10 auto_increment not null primary key mysql gt First name varchar 30 not null
47. l and remove all the components separately Table 1 page 12 lists the appropriate version and additional information You must install the following components separately e SUN JDK e 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 lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt Apache http server worked lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt Verify the Apache installation by opening a browser and entering the following website http lt YOUR_ WEB SERVER _IP gt 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 Components 15 16 Download the Sun JDK package f
48. l jdk bin java then setenv PATH PATH usr local jdk bin setenv JAVA_BINDIR usr local jdk bin setenv JAVA_ROOT usr local jdk setenv JAVA_HOME usr local jdk setenv JRE HOME usr local jdk unsetenv JDK HOME unsetenv SDK HOME setenv JDK_HOME usr local jdk setenv SDK_HOME usr local jdk else if x usr lib java jre bin java then it is IBMJava2 JRE or SunJava2 JRE setenv PATH PATH usr lib java jre bin setenv JAVA_BINDIR usr lib java jre bin setenv JAVA_ROOT usr lib java setenv JAVA_HOME usr lib java jre setenv JRE HOME usr lib java jre unsetenv JDK HOME unsetenv SDK HOME endif endif Log out of the system and then log back in to start using the revised profile 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 A NOTE Prior to installing Apache Tomcat you must verify that JDK is installed and configured on your system 1 A 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 follo
49. lling Configuring and Managing Web Server Middleware Stack Components 27 3 Insert the following line below the DocumentRoot line JkMount jsp examples workerl1 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 lt Connector gt element is enabled in the Tomcat file server xml and that this file is placed inside the lt Service gt element Verify that the following lines are included and not commented out in the SCATALINA HOME conf server xml file lt Connector port 8009 enableLookups false redirectPort 8443 protocol AJP 1 3 gt 5 Create the following file etc apache2 conf workers properties Add the following lines to the preceding file Define 1 real worker using ajp13 worker list worker1l1 Set properties for workerl ajp13 worker workerl type ajp13 worker workerl host lt YOUR_TOMCAT_SERVER_IP gt worker workerl port 8009 worker workerl1 lbfactor 50 worker workerl cachesize 10 worker workerl cache_timeout 600 worker workerl socket_keepalive 1 worker workerl socket_timeout 300 6 If necessary start Tomcat it by entering the following command CATALINA_HOME bin startup sh 7 Restart Apache by entering the following command etc init d apache2 restart 8 Verify that you can connect to Tomcat through the standard HTTP port served by Apache by
50. ls the following default components on the HP OVO Management server and are described in the following sections e Tools e Policies Monitor Tomcat with OpenView Tomcat SPI 49 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 Servlet Engine SPI Configure Tomcat Instrumentation Description Creates the SESPI directory and configurations files and libraries required by the SPI Shutdown Tomcat Start Tomcat Shuts down Tomcat server process Starts the Tomcat server process Start Log Monitor Stops the log monitor daemons Stop Log Monitor Policies Stops the log monitor daemons Table 4 provides an overview of the Policy group in the Tomcat SESPI Table 4 SE SPI Applications of the Policy Group 50 Polling Policy Type Policy Name Description Interval Threshold Measurement SESPI Tomcat CPU Usage Monitors the CPU usage 5 minutes 90 Threshold of the Tomcat server Measurement SESPI Tomcat Mmry Usage Monitors the memory 5 minutes 90 Threshold usage of the Tomcat server Open Message SESPI Messages Provides the interface Interface for displaying error messages from the SPI Service Auto Discovery SESPI Tomcat Service Provides discovery of Discovery the Tomcat Servlet engine Scheduled Task SESPI Tomcat Monitor Monitors the Process of 1 minute Process
51. mmand rpm q php5 apache2 mod php5 Create a sample file test file named srv www cgi bin test pl and add the following lines usr bin perl print Content type text plain n n print Hello World n Assign execute permissions to the file by entering the following command chmod x srv www cgi bin test pl Edit the etc sysconfig apache2 file by adding per1 to the line with APACHE MODULES After completing this edit the line should look like the following APACHE MODULES perl Restart Apache by entering the following command etc init d apache2 restart If there are any errors check the following log files var log apache2 error_log var log apache2 access_log Installing Configuring and Managing Web Server Middleware Stack Components 29 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 APACHE MODULES python 3 Create the following test file srv ww
52. o root and retrieve it via hibernate Lari FirsrNare lasrNaine W 8m th rr 4 Delete the test data then query again via hibernate Ls Lb Fustan LasUsaux Installing Configuring and Managing Web Server Middleware Stack Components 41 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 S
53. 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 The preceding element can be repeated an arbitrary number of times Separates items in a list of choices 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 HP Open Source Web Server Middleware Stack The following components comprise the HP OSMS Web Server Middleware Stack Apache Web Server The 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 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 Hibernate Hibernate is an object relational persistence and query service for Java Hibernate provides support for collections and object relation
54. ormation 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 lt YOUR_WEB_SERVER_IP gt webalizer Figure 8 shows an example of a Webalizer usage report web page Installing Configuring and Managing Web Server Middleware Stack Components 21 Figure 8 Webalizer Usage Report Usage Statistics for bISSp 16 a Ganernaed OS Tob D07 LIAS EST Buih dog Mentir Taisi EENE ee oo M tee m 7 206 3 a 3 a er For detailed information see the Webalizer website at http www mrunix net webalizer Using Virtual Host Support 22 A virtual host runs more than one website on a single server For example www websitel 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 e For Windows systems edit the C WINDOWS system32 drivers etc hosts file e For Linux systems edit the etc hosts file 2 Add the following line lt YOUR_WEB_SERVER_IP gt
55. ottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The Authentication and Authorization worked lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt 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 Components 43 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 lt 5 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 configu
56. ration 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 lt YOUR_WEB SERVER IP gt 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_1dap 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
57. rnateSessionFactory java The file HibernateSessionFactory class is generated Create a Hibernate mapping file named Users hbm xm1 in the directory SCATALINA HOME webapps SimpleDemo WEB INF classes com hp osms hibernate according to the definition in the USERS table that contains the following lines lt xml version 1 0 gt lt DOCTYPE hibernate mapping PUBLIC Hibernate Hibernate Mapping DTD 3 0 EN http hibernate sourceforge net hibernate mapping 3 0 dtd gt lt hibernate mapping gt lt class name com hp osms hibernate Users table USERS gt lt id name userId type java lang Long gt lt column name USER_ID precision 10 scale 0 gt lt generator class native gt lt param name sequence gt HIBERNATE SEQUENCE lt param gt lt generator gt lt id gt Installing Configuring and Managing Web Server Middleware Stack Components 39 40 10 lt property name firstName type java lang String gt lt column name FIRST NAME length 30 gt lt property gt lt property name lastName type java lang String gt lt column name LAST NAME length 30 gt lt property gt lt class gt lt hibernate mapping gt 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 H
58. rom 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 Create a symbolic link for Sun JDK by entering the following In s usr java jdk1 5 0 10 usr local jdk 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 shor etc profile d alljava csh For the alljava sh file add the following lines if x usr local jdk bin java then export PATH S 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 if x usr loca
59. ror 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 lt YOUR_WEB_SERVER_IP gt 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 lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The page you request does not exist Local redirects example lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt Installing Configuring and Managing Web Server Middleware Stack Components 25 Verify the custom local URL redirect message by opening a browser and entering the following website http lt YOUR WEB SERV
60. rt 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 Introduction 9 Typographic Conventions This document uses the following typographical conventions Command ComputerOut Ctrl x ENV IRONVAR ERRORNAME Key Term UseriInput VARIABLE continuation character HP Encourages Your Comments A command name or qualified command phrase Text displayed by the computer A key sequence A sequence such as Ctrl x indicates that you must hold down the key labeled Ctrl while you press another key or button The name of an environment variable for example PATH The name of an error usually returned in the errno variable The name of a keyboard key Return and Enter both refer to the same key The defined use of an important word or phrase 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
61. s 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 mod_jk 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 mod_ssl The mod_ss1 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_ss1 Perl Perl Practical Extraction and Report Language has long been a popular text processing language Recently Perl has become popular for the development and deployment of web applications PHP PHP is a scripting language that can be embedded in HTML pages allowing developers to add more dynamic contents to their web applications A large portion of the PHP syntax is similar to C and Java Python Python is an object oriented language that has a clean straightforward syntax Python can be extended to exploit facilities implemented in other programming languages such as C and C JDK The Java Platform Standard Edition De
62. ssssiseesrssesressesttstssestesessesresseseesenseseees 34 Connecting Tomcat to MySQL or Oracle Using Hibernate s ccisccsssscsceatssvcaresbeshecasareoeergpbitokerteveaess 36 Installing Hibernate Tomcat and JDK sessssssessessserssisssserssessrsreessessreseenseesreseesseesresnesserssesees 36 Configuring a Database Driver in Tomcat esesssesssssessssisrisessserssisnsererssisneerenseesresnesserssesees 36 Adding Test Data to the Databases s sessseissisessseessessseserssesssereessessrereenseesrereensersresnesserssesees 36 Table of Contents 3 4 Creating a Simple Application in TomCats ic ccascsisessceceanivenitets eis settee rahe east bestenaepades 37 Verifying the Simple Application Operation ss sssesssssesssrssssseessisssseesseesesrersersreseesserssesees 41 Secure the Web Server Sackom rren are A E E a A e a i 42 Enabling HTTPS Support in the Apache HTTP Server seesessssssrsessseissessrsseessersreseerserssesees 42 Apache HTIP Server Authorization sosse sssini aeee ieis siie 43 Creating Test index html Piles s5 c cats wig rasavepeasabduc iieiea EARE Apa 43 Configuring the Authorized Overrides ssid civccwsscstanguaptctenveseceve rai neues tisiag avon devattdanseaite 43 Greating a Password Piles iseen estier taae tear EaR setups wet Sines wed acta ise 44 Creating the Distributed Config uration Mile vtcc ctostua inadat dian patictantinyiiedabiaseenined 44 Restarting the Apache HTTP Server is cases ive
63. st 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 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 gt grant all on osmsdb to osmsuser identified by osmsuser mysql gt 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 1 Create a JSP file named CATALINA_HOME webapps ROOT mysqltest jsp and insert the following lines lt page contentType text html import java io java sql javax sql javax naming gt lt html gt lt head gt lt title gt Tomcat gt MySQL Test lt title gt lt link rel stylesheet href style master css type text css gt lt meta http equiv cache control content no cache gt lt head gt lt body gt lt InitialContext ctx new InitialContext DatabaseMetaData dm null DataSource ds DataSource ctx lookup java comp env jdbc mysqlDB Connection conn null Statement stmt null try conn ds getConnection dm conn getMetaData out println Connected to gt data
64. step guide that describes Hibernate as a technology that handles mapping between Java objects and relational database tables http www hibernate org 152 html Contains the Hibernate FAQs that offers helpful advice regarding concepts common problems and performance issues http www hibernate org 9 html Contains the Hibernate Wiki a discussion forum regarding design details and other aspects of Hibernate http www hibernate org 37 htm Appendix D Hibernate Test Application Source Code This appendix provides the contents of the following two Hibernate Test Application source code files e HibernateSessionFactory java e hibernate jsp The following are the contents of the HibernateSessionFactory java file package com hp osms hibernate utility import org hibernate HibernateException import org hibernate Session import org hibernate cfg Configuration public class HibernateSessionFactory private static String CONFIG FILE LOCATION hibernate cfg xml private static final ThreadLocal lt Session gt threadLocal new ThreadLocal lt Session gt private static Configuration configuration new Configuration private static org hibernate SessionFactory sessionFactory private static String configFile CONFIG FILE LOCATION private HibernateSessionFactory public static Session getSession throws HibernateException Session session Session threadLocal get if session null session isOpen
65. t 80 syn j ACCEPT iptables save sbin SuSEfirewall2 restart Appendix B Frequently Asked Questions 53 Appendix C Vendor Information Reference 54 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 The Apache Tomcat 5 5 Servlet JSP Container Documentation Index PHP Documentation Perl Documentation Python Documentation Hibernate Getting Started Hibernate FAQs Hibernate Wiki 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 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 http tomcat apache org tomcat 5 5 doc index html Contains the PHP online documents in multiple languages http www php net docs ph Contains the core documentation for Perl Version 5 8 8 that can be downloaded in both HTML and PDF formats http perldoc perl or Includes a documentation index that covers such documents as the Python Tutorial Beginner s Guide to Python and additional documentation http www python org doc Contains a step by
66. tesesvelosiccedses eecace si Geslacdsvelecaseecsts wwendess aetebitaens 27 Configuring the Apache and Tomcat Connector ivecensesvdcndoadtirtinrniierdawlatenaae 27 Integrating the Apache Web Server and PEIP rics ccisecstintacesesivewcass donee evtevobastvoivadsndianeascigebetouness 29 Integrating the Apache Web Server and Per scclecm ss alive cee access micenhewsbepesacagpbancbeatgedte sc 29 Integrating the Apache Web Server and Python cgityicete cn teedintar tien ean Ga tine 30 Connecting Tomcat t6 a Databasen iii vs vistas best iia eetecaaavn ben ebedba tied Anon e EEEa A esh 30 Connecting Tomcat and MySQLi aae D a T E E E E EE a 31 Obtaining and Installing the JDBC Dr vets s 50 2 sive ntiwwine ciyurneeet seeatis an cusiueen nmin iatcs 31 Creating a New Data SOUTE seer meen cero re mere mer nr cere eect Tren reer reer ct corr ry eer te 31 Configuring the MySQL SOny etic iss ves casavehin sy ewncedeanenatirns e nT in ta Ei Sei E EE E sits eee 32 Testing MySQL Database Connectivity sic eves cian ncshecutsih ola tna a a aa 32 Connecting Tomcat and Oracles ici seers esnie iae En aaeain a o iie Sa E aa Ea a Ean Aie 33 Obtaining and Installing the Oracle JDBC Driver nsnssnsseseseeseesessessestesessestesessesesssseesesseseeses 34 Creating an Oracle Data Source nisnin uaren Gansbecteinwesstedonses aaRS AEn 34 Configuring dhe Oracle Servers ccicsiuisrssne tists inne aS EE E aa iiaa 34 Testing the Oracle Database Connectivity ssesssssssesst
67. 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 OVO SPI agent RPC Management Apache HTTPD Web Server mod_php ldap mod_auth_Ida mod_python mod_perl LDAP LDAPS 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 1ib64 apache2 modules 2 Edit the Apache Web server configuration file etc apache2 default server conf adding the following lines Load mod_jk LoadModule jk_module usr 1ib64 apache2 mod_jk so Configure mod_jk JkShmFile var log apache2 memory shm JkWorkersFile etc apache2 workers properties JkLogFile var log apache2 mod_jk log JkLogLevel info Insta
68. the Tomcat server 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 Complete these steps 1 Install and verify the Linux installation Status 2 Configure the basic Apache HTTP Server page 15 3 Install and configure Sun JDK or BEA JRockit 4 Install and configure Tomcat page 17 Implement any advanced Apache HTTP server features Optional page 18 6 Integrate the Web Server stack components page 27 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 7 Connect Tomcat to a MySQL page 31 or Oracle Server page 33 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 8 Connect Tomcat to MySQL or Oracle using Hibernate page 36 a Install Hibernate3 Tomcat and JDK b Configure MySQL or Oracle drivers in Tomcat c Add test data to the database d Create a simple demonstration application in Tomcat e Verify the simple demonstration application operation 9 Enable HTTPS support in the Apache HTTP Server page 42 10 Implement Apache HTTP Server authorization page 43
69. u request does not exist External redirects example Using Per User Web Directories 26 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 Create an HTML file named home tester public html index html1 that contains the following lines lt HTML gt lt HEAD gt lt HEAD gt lt BODY DIR LTR gt lt P ALIGN CENTER STYLE margin bottom Ocm gt lt FONT FACE Times New Roman serif gt lt FONT SIZE 6 gt The is personal homepage of user tester lt FONT gt lt FONT gt lt P gt lt BODY gt lt HTML gt 3 Verify that the per user web directory configuration was successful by opening a browser and entering the following website http lt YOUR_WEB_ SERVER _IP gt 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
70. uration PUBLIC Installing Configuring and Managing Web Application Server Middleware Stack Components 33 Hibernate Hibernate Configuration DTD 3 0 EN http hibernate sourceforge net hibernate configuration 3 0 dtd gt lt hibernate configuration gt lt session factory gt lt property name show_sql gt true lt property gt lt property name connection datasource gt java comp env OracleDS lt property gt lt property name dialect gt org hibernate dialect Oracle9Dialect lt property gt lt mapping resource com hp osms hibernate Users hbm xml gt lt session factory gt lt hibernate configuration gt NOTE The values of OracleDS and MySqIDS are the data source names that are configured in the Tomcat Web server 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 SCATALINA_HOME webapps SimpleDemo WEB INF classes com hp osms hibernate utility and add the following lines so the application can interact with Hibernate package com hp osms hibernate utility import org hibernate HibernateException import org hibernate Session import org hibernate cfg Configuration public class HibernateSessionFactory private static String CONFIG FILE LOCATION hibernate cfg xml private static final ThreadLocal lt Session gt threadLocal new ThreadLocal lt Session gt private static Conf
71. uthLDAPBindPassword secret lt Directory gt 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 lt YOUR WEB SERVER IP gt 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 Create a web application named myweb in your Tomcat Web server by adding the following code to the file S CATALINA_HOME conf server xml TIP To apply the following lt Realm gt configuration to all of your virtual machines insert it between the lt Engine gt tags You can also apply it to the scope of a virtual host by inserting it between the lt Host gt tags because this relies on the content being protected lt Realm className org apache catalina realm JNDIRealm connectionURL ldap YOUR_CDS_SERVER_IP 389 connectionName cn Manager dc example dc com connectionPassword secret userPattern uid 0 ou people dc osm dc example dc com roleBase ou groups dc osm dc example
72. velopment Kit JDK is a 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 Stack 11 12 Figure 1 Web Server Stack Architecture Apache HTTPD Web Server mod_php P mod_python i mod_perl 3 3 5 v fe E Mai OVO SPI agent RPC vet Seale Me 5 813 MySQL or 2 f4 8 f4 fe mec Oracle AJP EE ka 8 Database o QY 8 z LDAP LDAPS Symas CDS ner H LDAP LDAPS Table 1 lists the software used to test the configurations described in this blueprint Table 1 Software Test Configuration Software Package Package Name Distributor Website Link Version Apachehttpd 2 2 0 21 2 apache2 2 0 21 2 x86_64 rpm Novell Apache httpd website Apache 5 5 20 apache tomcat 5 5 20 tar gz Apache Apache Tomcat Tomcat website Hibernate 3 2 1 hibernate 3 2 1 tar gz Hibernate Hibernate website mod_ssl 2 2 0 21 2 Include with Novell mod_ssl website apache2 prefork 2 2 0 21 2 x86 64 rpm mod_jk 1 2 20 tomcat connectors 1 2 20 sre tar gz Apache mod jk website Perl 5 8 8 14 2 perl 5 8 8 14 2 x86_64 rpm Novell Perl website PHP 5 1 2 29 5 php 5 1 2 29 5 x86_64 rpm Novell PHP website Python 2 4 2 18 2 python 2 4 2 18 2
73. ver uptime 3 minutes 16 seconds 1 requests currently being processed 5 idle workers n s Starting up R Reading Request alive read D DNS Lookup Closing connection oggng G Gracefully finishing T Idle cleanup of worker Open slot with no current process PID Rey 4206 in state _ 4207 in state U 4208 in state _ 4209 in state _ 4210 in state _ 4224 in state L To obtain a full report with current status information you need to use the ExcendedStatus On directive ISSLITLS Session Cache Status Apache 2 2 0 Linux SUSE Server at b135p 16 test Port 80 Display the server information web page by opening a browser and entering the following website http lt YOUR_WEB_SERVER_IP gt server info The Apache Server Information web page opens as shown in Figure 7 Figure 7 Apache Server Information Apache Server Information 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
74. w htdocs test py Add the following lines to the preceding file from mod_python import apache def handler req regq content type text plain req write Hello World return apache OK 4 Edit the following file etc apache2 conf d mod_python conf Add the following lines to the preceding file lt Directory AddHandler mod_python py PythonHandler test PythonDebug On lt Directory gt 5 Restart Apache by entering the following command etc init d apache2 restart 6 Verify that Python works by opening a browser and navigating to http lt YOUR_HOSTNAME gt test py The web page displays the following text Hello World If there are any errors check the following log files var log apache2 error_log var log apache2 access_ log Connecting Tomcat to a Database 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 Figure 11 Tomcat Connections Using JDBC Management OVO SPI agent RPC Apache HTTPD Web Server mod_php mod_python Hibernate mod_auth_Idap mod_Idap Web container JDBC connector LDAPS Symas CDS Server Tomcat uses the data source concept to create database connections A data source must be configured in an XML configuration file The data sour
75. wing 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 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 CATALINA _HOME usr local apache tomcat export CATALINA HOME Log out of the system and then log back in to it to start using the revised profile 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 Verify that the Tomcat installation once the startup is complete by opening a browser and entering the following URL http lt YOUR_TOMCAT SERVER IP gt 8080 The Tomcat web page is displayed as in Figure 5 Figure 5 Tomcat Successful Installation Verification Apache Tomeat5 17 jr B Software Foundation htto www apache org E you re seeing this page via a web browser it means you ve setup Tomeat successfully Congratulations Installing Configuring and Managing Web Server Middleware Stack Components 17 EY NOTE Ifthe iptables firewall is enabled you will not be able to connect to Tomcat from a remote computer 6 If necessary stop Tomcat by entering
76. x86_64 rpm Novell Python website Sun JDK 1 5 0_10 jdk 1_5_0_10 linux amd64 rpm bin Sun Sun Java website A 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 Client network ry Z Y per PE ENES l l Read and Apache Web Server eee Lo d 1 Execute with mod_jk I Read I LS lt SJ rmm KS i Read j ae Ga OpenView Management Apache Tomcat Server Symas CDS Server with Hibemate n Server for authentication y i Read and 1 Execute Oracle Database Server My SQL Database Server 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 e Connection of the Apache Web Server and the Tomcat Web Container using the mod_jk module e Connection of Apache Tomcat Server to a database such as MySQL or Oracle using a JDBC Driver e Support from Apache Web Server for login authentication using Java Authentication and Authorization Service JAAS with the Symas Connexitor Directory Services CDS Server e Use of an additional required OpenView Management
77. y server edit the following file etc apache2 default server conf Add the following lines to the preceding file ProxyRequests On ProxyVia On lt Proxy gt Order deny allow Deny from all Allow from all lt Proxy gt 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 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 lt YOUR_ PROXY SERVER _IP gt 80 http lt YOUR_ WEB SERVER IP gt test html 6 View the access log file on the Apache Proxy server Messages similar to the following are contained in the file YOUR_WEB_ BROSWER_IP 03 Feb 2007 13 30 48 0500 GET http YOUR_WEB SERVER_IP test html HTTP 1 0 200 206 ApacheBench 2 0 40 dev View the access log file on the Apache HTTP server Messages similar to the following are contained in the file YOUR_PROXY_SERVER_IP 24 May 2007 11 38 46 0800 GET test html HTTP 1 1 200 206 ApacheBench 2 0 40 dev 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 e Plaintext e Local URL redirect e External URL redirect Customizing Plain Text Responses The following is an example of how to customize a plain text er
78. ymas CDS provides this authentication mechanism by storing user credentials in the directory server Enabling HTTPS Support in the Apache HTTP Server The mod_ss1 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 42 Run the shell script usr bin gensslcert to create dummy ssl keys for mod _ss1 This tool copies the etc apache2 ssl crt ca crt file to srv www htdocs CA crt and creates the following key files e etc apache2 ssl crt ca crt e etc apache2 ssl key server key e etc apache2 ssl crt server crt e etc apache2 ssl csr server csr Edit the etc sysconfig apachez2 file by adding ss1 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 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 Restart Apache by entering the following etc init d apache2 restart 5 Perform the test by navigating to the website located at https lt YOUR_HOSTNAME gt Verify that the certificate is displayed as in Figure 15 Figure 15 SSL_Ena
79. ystem and entering the following command ab2 c 1000 n 1000 http lt YOUR_WEB_SERVER_IP gt abtest html Where e The value of the n option sets the number of requests e The value of the c option 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 A Apache 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 lt NUMBER gt This comman

Download Pdf Manuals

image

Related Search

Related Contents

VIS-DES-UOD-06048-00..  Version1  ASUS M70AD UA8654 User's Manual    Vintage Overdrive pédale d`effet notice d`utilisation  WACOM Graphire User's Manual  

Copyright © All rights reserved.
Failed to retrieve file