30.3 Starting and Stopping Apache

If configured with YaST (see Section 30.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 12.2.2, Init Scripts for a general information about init scripts.). The rcapache2 command takes the following parameters:

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 30.6, Setting Up a Secure Web Server with SSL.

stop

Stops Apache by terminating the parent process.

restart

Stops 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.

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).

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.