|
|
|
|
28.3 Starting and Stopping Apache
If configured with YaST (see
Section 28.2.2, Configuring Apache with YaST), Apache is started
at boot time in runlevels 3 and 5 and stopped in runlevels 0, 1, 2, and
6. You can change this behavior using YaST's runlevel editor or the
command line tool chkconfig.
To start, stop, or manipulate Apache on a running system, use the init
script /usr/sbin/rcapache2 (refer to
Section 14.2.2, Init Scripts for a general information
about init scripts.). The rcapache2 command takes the
following parameters:
- status
-
Checks whether Apache is started.
- start
-
Starts Apache if it is not already running.
- startssl
-
Starts Apache with SSL support if it is not already running. For more
information about SSL support, refer to
Section 28.6, Setting Up a Secure Web Server with SSL.
- stop
-
Stops Apache by terminating the parent process.
- restart
-
Stops and then restarts Apache. Starts the Web server if it was not
running before.
- try-restart
-
Stops then restarts Apache only if it has been running before.
- reload or graceful
-
Stops the Web server by advising all forked Apache processes to first
finish their requests before shutting down. As each process dies, it
is replaced by a newly started one, resulting in complete
restart of Apache.
HINT:
rcapache2 reload is the preferred
method of restarting Apache in production environments, for example,
to activate a change in the configuration, because it allows all
clients to be served without causing connection break-offs.
- restart-graceful
-
Starts a second Web server that immediately serves all incoming
requests. The previous instance of the Web server continues to handle
all existing requests for a defined period of time configured with
GracefulShutdownTimeout.
rcapache2 restart-graceful is
either useful when upgrading to a new version or when having changed
configuration options that require a restart. Using this option
ensures a minimum server downtime.
GracefulShutdownTimeout needs to be set,
otherwise restart-graceful will result in a regular
restart. If set to zero, the server will wait indefinitely until all
remaining requests have been fully served.
A graceful restart can fail in case the original Apache instance is
not able to clear all necessary ressources. In this case, the command
will result in a graceful stop.
- stop-graceful
-
Stops the Web server after a defined period of time configured with
GracefulShutdownTimeout in order to ensure
that existing requests can be finished.
GracefulShutdownTimeout needs to be set,
otherwise stop-graceful will result in a regular
restart. If set to zero, the server will wait indefinitely until all
remaining requests have been fully served.
- configtest or extreme-configtest
-
Checks the syntax of the configuration files without affecting a
running Web server. Because this check is forced every time the server
is started, reloaded, or restarted, it is usually not necessary to run
the test explicitly (if a configuration error is found, the Web server
is not started, reloaded, or restarted). The
extreme-configtest options starts the Web server as
user nobody and actually
loads the configuration, so more errors can be detected. Note that
although the configuration is loaded, it is not possible to test the
SSL setup, because the SSL certificates cannot be read by
nobody.
- probe
-
Probes for the necessity of a reload (checks whether the configuration
has changed) and suggests the required arguments for the
rcapache2 command.
- server-status and full-server-status
-
Dumps a short or full status screen, respectively. Requires either
lynx or w3m installed as well as the module mod_status enabled. In
addition to that, status must be added to
APACHE_SERVER_FLAGS in the file
/etc/sysconfig/apache2.
HINT: Additional Flags
If you specify additional flags to the rcapache2,
these are passed through to the Web server.
|
|
|