Starting and Stopping the Server


The procedure for starting and stopping the Apache Web server is no different from that of many other daemons. You can use the chkconfig command to set the httpd service to start at boot time.

Cross-reference: 

See Chapter 12 for detailed information on the inner workings of the shell scripts that control starting and stopping daemons and server processes.

The /etc/init.d/httpd shell script accepts any of a handful of command-line arguments. If it is called with the argument start, the httpd script will run one master daemon process (owned by root), which will spawn other daemon processes (equal to the number specified by the StartServers directive) owned by the user apache (from the User and Group directives). These processes are responsible for responding to incoming HTTP requests. If called with stop, the server will be shut down as all httpd processes are terminated.

If given a command-line argument of restart, the script will simply execute stop and start procedures in sequence. Using reload as the argument will send the hangup signal (-HUP) to the master httpd daemon, which causes it to reread its configuration files and restart all the other httpd daemon processes. The shell script also supports an argument of status, which will report if the daemon is running and, if it is, the PIDs of the running processes. All other command-line arguments result in an error and cause a usage message to be printed.

The actual binary for Apache, /usr/sbin/httpd, supports several command-line arguments, although the default values are typically used. The possible command-line arguments are listed in Table 21-7.

Table 21-7: Command-Line Arguments to httpd

Argument

Description

-c directive

Read the configuration files and then process the directive. This may supersede a definition for the directive within the configuration files.

-C directive

Process the directive and then read the configuration files. The directive may alter the evaluation of the configuration file, but it may also be superseded by another definition within the configuration file.

-d directory

Use directory as the ServerRoot directive, specifying where the module, configuration, and log file directories are located.

-D parameter

Define parameter to be used for conditional evaluation within the IfDefine directive.

-f file

Use file as the ServerConfigFile directive, rather than the default of /etc/httpd/conf/httpd.conf.

-h

Display a list of possible command-line arguments.

-l

List the modules linked into the executable at compile time.

-L

Print a verbose list of directives that can be used in the configuration files, along with a short description and the module that contains each directive.

-S

List the configured settings for virtual hosts.

-t

Perform a syntax check on the configuration files. The results will either be:

Syntax OK 

or an error notification, for example:

Syntax error on line 118 of  /etc/httpd/conf/httpd.conf 

-T

Same as -t, except that there is no check of the DocumentRoot value.

-v

Print the version information:

Server version: Apache/2.0.48  Server built: March 17 2004 11:23:11 

-V

List the version information and any values defined during compilation:

Server version: Apache/2.0.48  Server built: March 17 2004 11:23:11  Server's Module Magic Number: 20020903:5  Architecture: 32-bit  Server compiled with  -D APACHE_MPM_DIR="server/mpm/prefork"  -D APR_HAS_MMAP  -D APR_HAVE_IPV6 (IPV4-mapped addresses enabled)      .      .      .  -D SERVER_CONFIG_FILE="conf/httpd.conf" 

-X

Only the single master daemon process is started, and no other httpd processes will be spawned. This should be used only for testing purposes directly from the command line.




Red Hat Fedora Linux 3 Bible
Red Hat Fedora Linux 3 Bible
ISBN: 0764578723
EAN: 2147483647
Year: 2005
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net