[ Pobierz całość w formacie PDF ]
.nitec.com, you need to add:Allow from 127.1.nitec.comThe dot in front of the domain name enables any host in the domain to accessthe server information.However, if you wish to limit this to a single host calledsysadmin.domain.com, then change the Allow from line to:Allow from 127.1 sysadmin.domain.comAfter the server is configured and restarted, the server information is obtainedfrom the localhost (that is, running a Web browser such as lynx on the server itself)by accessing http://localhost/server-info.e4821-2 ch08.F 2/22/02 10:13 AM Page 215Chapter 8 &' Monitoring Access to Apache215This returns a full configuration page for the server and all modules.If you wish toaccess it from a different location, use the fully qualified server name in place oflocalhost.For example, if your Web server is called www.nitec.com, you accessthe server information by using http://www.nitec.com/server-info.The mod_infomodule also provides a directive called AddModuleInfo, whichenables you to add descriptive text in the module listing provided by the mod_infomodule.The descriptive text could be anything including HTML text.AddModuleInfohas this syntax:AddModuleInfo module_name descriptive_textFor example:AddModuleInfo mod_info.c See man mod_infoThis shows an HTML link next to the listing of mod_info.c, providing a quick way toget more information on the module from the Apache online manual, as shown below.Module Name: mod_info.cContent handlers: (code broken)Configuration Phase Participation: Create Server Config, Merge Server ConfigsModule Directives:AddModuleInfo - a module name and additional information on that moduleCurrent Configuration:AddModuleInfo mod_info.c man mod_infoAdditional Information:man mod_infoYou can also limit the information displayed on the screen as follows:&' Server configuration only.Use http://server/server-info?server,which shows the following information:Server Version: Apache/2.14 (Unix)Server Built: Mar 14 2001 12:12:28API Version: 20010224:1Hostname/port: rhat.nitec.com:80Timeouts: connection: 300 keep-alive: 15MPM Information: Max Daemons: 20 Threaded: no Forked: yesServer Root: /usr/local/apacheConfig File: conf/httpd.conf&' Configuration for a single module.Use http://server/server-info?module_name.c.For example, to view information on only the mod_cgimodule, run http://server/server-info?mod_cgi.c, which shows thefollowing information:e4821-2 ch08.F 2/22/02 10:13 AM Page 216Part II &' Web Site Administration216Module Name: mod_cgi.cContent handlers: (code broken)Configuration Phase Participation: Create Server Config,Merge Server ConfigsModule Directives:ScriptLog - the name of a log for script debugging infoScriptLogLength - the maximum length (in bytes) of the scriptdebug logScriptLogBuffer - the maximum size (in bytes) to record of aPOST requestCurrent Configuration:&' A list of currently compiled modules.Use http://server/server-info?list, which shows the following information:mod_cgi.cmod_info.cmod_asis.cmod_autoindex.cmod_status.cprefork.cmod_setenvif.cmod_env.cmod_alias.cmod_userdir.cmod_actions.cmod_imap.cmod_dir.cmod_negotiation.cmod_log_config.cmod_mime.chttp_core.cmod_include.cmod_auth.cmod_access.ccore.cOf course, your listing will vary based on which modules you have enabled duringsource configuration.Now, let s look at how you can monitor the status of a runningApache server.Enabling status pages with mod_statusThe mod_statusmodule enables Apache administrators to monitor the server viathe Web.An HTML page is created with server statistics.It also produces anotherpage that is program friendly.The information displayed on both pages includes:&' The current time on the server system&' The time when the server was last restartede4821-2 ch08.F 2/22/02 10:13 AM Page 217Chapter 8 &' Monitoring Access to Apache217&' Time elapsed since the server was up and running&' The total number of accesses served so far&' The total bytes transferred so far&' The number of children serving requests&' The number of idle children&' The status of each child, the number of requests that child has performed,and the total number of bytes served by the child&' Averages giving the number of requests per second, the number of bytesserved per second, and the average number of bytes per request&' The current percentage CPU used by each child and used in total by Apache&' The current hosts and requests being processedNoteSome of the above information is only available when you enable displaying ofsuch informatino using the ExtendedStatus directive, which is discussed later inthis section.Like the mod_infomodule, this module is also not compiled by default in the stan-dard Apache distribution, so you need use the --enable-statusoption with theconfigurescript and compile and install Apache.Viewing status pagesAfter you have the mod_statusmodule compiled and built into your Apacheserver, you need to define the URL location that Apache should use to display theinformation.In other words, you need to tell Apache which URL will bring up theserver statistics on your Web browser.Let s say that your domain name is domain.com, and you want to use thefollowing URL:http://www.domain.com/server-statusUsing the container, you can tell the server that you want it tohandle this URL using the server-status handler found in the mod_statusmodule.The following will do the job:SetHandler server-statusOrder deny,allowDeny from allAllow from 127.1.domain.come4821-2 ch08.F 2/22/02 10:13 AM Page 218Part II &' Web Site Administration218Here, the SetHandlerdirective sets the handler (server-status) for the previouslymentioned URL.After you have added the configuration in httpd.conf, restart theserver and access the URL from a browser.The containerenables you to access the status information from any host in your domain, or fromthe server itself.Don t forget to change.domain.comto your real domain name, andalso don t forget to include the leading dot.TipYou can also have the status page update itself automatically using the http://server/server-status?refresh=NURL to refresh the page every N seconds.To view extended status information, add the ExtendedStatus Ondirective inthe server configuration context.For example, your entire server status-relatedconfiguration in httpd.confcould look as follows:ExtendedStatus OnSetHandler server-statusOrder deny,allowDeny from allAllow from 127.1.domain.comAn example of the extended status information is shown here:Apache Server Status for rhat.nitec.comServer Version: Apache/2 [ Pobierz całość w formacie PDF ]