11.5. Managing Your Web Server
Despite the enormous number of options found in the httpd.conf configuration file, configuration is not the biggest task you undertake when you run a web server. Configuration usually requires no more than adjusting a few options when the server is first installed; however, monitoring your server's usage and performance and ensuring its reliability and security are daily tasks. The Apache server provides some tools to simplify these tasks.
11.5.1. Monitoring Your Server
Apache provides tools to monitor the status of the server, and logs that keep a history of how the system is used and how it performs over time. The earlier discussion of logging configuration touched on these issues. We even looked at a technique for observing log entries in real time.
A better way to monitor your server in real time is the server-status monitor. This monitor must either be compiled in to httpd or installed as a dynamically loadable module. These two lines from the Solaris httpd.conf configuration file install the loadable module:
LoadModule status_module modules/mod_status.so AddModule mod_status.c
Enable the monitor in the httpd.conf file by inserting the Location /server-status container. The Solaris httpd.conf file has the Location /server-status container predefined, but it is commented out of the configuration. To enable the monitor, uncomment the lines and edit the Allow directive to specify the hosts that will be allowed to monitor the server. For example:
<Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from wrotethebook.com </Location>
Once the monitor is installed and enabled, access it from your browser. For our sample system, we use the URL http://www.wrotethebook.com/server-status/?refresh=20. The refresh value is not required, but using it will cause the status display to update automatically. In this example, we are asking for a status update every 20 seconds. Figure 11-6 shows the status screen for our test server.
Figure 11-6. The Apache server status display
Monitoring tells you about the real-time status of your server. Logging provides information about how your server is used over time. Together, logging and monitoring can help you maintain a healthy, useful web service.
Copyright © 2002 O'Reilly & Associates. All rights reserved.