HP 5991-5565 manual Apache Http Server Log, # /etc/init.d/apache2 restart, # webalizer

Page 21

Apache HTTP Server Log

The Apache HTTP Server provides a detailed and flexible information-logging mechanism. The two most important log files are the error and access logs. The default location for the Apache HTTP Server log files is the following directory: /var/log/apache2

Using the Error Log to Diagnose the Apache HTTP Server

The Apache HTTP Server records diagnostic information and all errors encountered while processing requests to the error log file, error_log.

For example, if you visit a nonexistent URL, the following 404 error is generated:

The requested URL /non-exist/ was not found on this server.

All error information is recorded in the default error log file, which you can obtain by entering the following command:

#tail –f /var/log/apache2/error_log

The following message is added to the end of the file:

[Sat Feb 03 13:03:55 2007] [error] [client 10.100.0.86] File does not exist: /srv/www/htdocs/non-exist

Using Webalizer to Perform Apache HTTP Server Log Analysis

Webalizer is an analysis tool that you can use to generate detailed usage reports using the information recorded in the Apache HTTP Server logs. Webalizer provides easy-to-read reports in HTML format that you can customize for your needs.

Use the following procedure to set up Webalizer:

1.Modify the Webalizer configuration file, /etc/webalizer.conf, by adding the following 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 'bl35p-16' Reading history file... webalizer.hist Generating report for February 2007 Generating summary report

Saving history information...

307 records in 1.00 seconds, 307/sec

Verify that the server status configuration is correct by opening a browser and entering the following website:

http://<YOUR_WEB_SERVER_IP>/webalizer

Figure 8 shows an example of a Webalizer usage report web page.

Installing, Configuring, and Managing Web Server Middleware Stack Components 21

Image 21
Contents HP Open Source Middleware Stacks Blueprint Copyright 2007 Hewlett-Packard Development Company, L.P Table of Contents Monitor Tomcat with OpenView Tomcat SPI Oracle Database Test Webalizer Usage ReportPage List of Tables Page Introduction HP ServicesExecutive Summary Intended AudienceHP Encourages Your Comments Typographic ConventionsUserInput Feedback@fc.hp.comWeb Server Stack Architecture HP Open Source Web Server Middleware StackWeb Server Stack Architecture Installing and Verifying the Linux Distribution Installing the Linux DistributionRequired Packages and Installation Recommendations YaST Software Selection and System Tasks Verifying the Linux Distribution InstallationInstalling and Configuring Sun JDK on an HP Proliant System Configuring the Basic Apache Http ServerTomcat # /etc/init.d/apache2 start# ln -s /usr/java/jdk1.5.010 /usr/local/jdk For the alljava.sh file, add the following linesFor the alljava.csh file, add the following lines # java -version Installing and Configuring TomcatFollowing messages appear # /usr/local/apache-tomcat/bin/startup.shUsing the Apache Http Server Benchmarking Tool Advanced Apache Http Server FeaturesIf necessary, stop Tomcat by entering the following command # /usr/local/apache-tomcat/bin/shutdown.shApache Http Server Status and Information You can correct the error by entering the followingApachemodules definition should now look like the following Restart the Apache Http Server for the changes take effectApache Server Information web page opens, as shown in Figure Apache Server Status web page opens, as shown in FigureApache Http Server Log # /etc/init.d/apache2 restart# webalizer Using Virtual Host Support For detailed information, see the Webalizer website atCreate the following file Using Apache Http Server URL Redirection Configure virtual hosting by creating a file namedOn the second server, create the following Html file Edit the following configuration file Using Apache Http Server Proxy FeaturesAdd the following line to the preceding file Add the following lines to the preceding fileCreate the following Html file Error Responses and RedirectsPopulate the preceding file with the following lines Using Per-User Web DirectoriesIntegrating the Web Server Stack Components Configuring the Apache and Tomcat ConnectorIf there are any errors, check the following log files Restart Apache by entering the following commandInsert the following line below the DocumentRoot line Http//YOURHOSTNAME/jsp-examplesIntegrating the Apache Web Server and Perl Integrating the Apache Web Server and PHP# rpm -q php5 apache2-modphp5 Create the following test fileConnecting Tomcat to a Database Integrating the Apache Web Server and PythonWeb page displays the following text # tar zxf mysql-connector-java-version.tar.gz Connecting Tomcat and MySQL# $CATALINAHOME/bin/startup.sh # mysqladmin -u root -p create osmsdb# ps -efgrep mysqld # /etc/init.d/mysql startIf needed, start Tomcat by entering the following command Connecting Tomcat and OracleHttp//YOURHOSTNAME8080/mysqltest.jsp Test page opens as shown in FigureConfiguring the Oracle Server Obtaining and Installing the Oracle Jdbc DriverTesting the Oracle Database Connectivity Creating an Oracle Data SourceOracle Database Test Http//YOURHOSTNAME8080/oracleTest.jspInstalling Hibernate, Tomcat, and JDK Connecting Tomcat to MySQL or Oracle Using HibernateConfiguring a Database Driver in Tomcat # mysql -u root -p Password# sqlplus osmsusr/osmspass@osmsdbora Creating a Simple Application in TomcatFor a MySQL database server For an Oracle database serverAsm.jar asm-attrs.jar antlr-2.7.6rc1.jar File HibernateSessionFactory.class is generated This directory, create a Hibernate Pojo file named Preceding command creates a class file namedHttp//YOURHOSTNAME8080/SimpleDemo/hibernate.jsp Verifying the Simple Application OperationSecure the Web Server Stack Enabling Https Support in the Apache Http ServerRestart Apache by entering the following Apache default document root is Apache Http Server AuthorizationVerify that the certificate is displayed as in Figure Create the following test Html fileIf the login fails, the following message appears Protecting Apache Http Server Authorization with Symas CDSConfiguring Apache Http Server Services Html Head Protecting Tomcat Authorization with Symas CDSHtml Head # $CATALINA/bin/shutdown.sh # $CATALINA/bin/startup.sh Monitor Tomcat with OpenView Tomcat SPITomcat SPI Components Software Prerequisites and Reference GuidesPolicies ToolsComplete these steps Complete these steps # /sbin/SuSEfirewall2 stop Appendix B Frequently Asked QuestionsAppendix C Vendor Information Reference Appendix D Hibernate Test Application Source Code Following are the contents of the hibernate.jsp filePage Appendix D Hibernate Test Application Source Code