apachectl

From RaySoft

apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon.[1]

The apachectl script can operate in two modes. First, it can act as a simple front-end to the httpd command that simply sets any necessary environment variables and then invokes httpd, passing through any command line arguments. Second, apachectl can act as a SysV init script, taking simple one-word arguments like start, restart, and stop, and translating them into appropriate signals to httpd.[1]

Documentation

Syntax

apachectl [SUBCOMMAND]
apachectl [HTTPD-PARAMETER ...]

Subcommands & Parameters

configtest
Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error. This is equivalent to apachectl -t.
restart
Restarts the Apache httpd daemon. If the daemon is not running, it is started. This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn't die. This is equivalent to apachectl -k restart.
start
Start the Apache httpd daemon. Gives an error if it is already running. This is equivalent to apachectl -k start.
stop
Stops the Apache httpd daemon. This is equivalent to apachectl -k stop.

httpd Parameters

-c DIRECTIVE
Process the configuration DIRECTIVE after reading config files.
-C DIRECTIVE
Process the configuration DIRECTIVE before reading config files.
-d PATH
Set the initial value for the ServerRoot directive to PATH. This can be overridden by the ServerRoot directive in the configuration file.
-e LEVEL
Sets the LogLevel to LEVEL during server startup. This is useful for temporarily increasing the verbosity of the error messages to find problems during startup.
-E FILE
Send error messages during server startup to FILE.
-f FILE
Uses the directives in the FILE config on startup. If config does not begin with a /, then it is taken to be a path relative to the ServerRoot.
-k start|restart|graceful|stop|graceful-stop
Signals httpd to start, restart, or stop.
-l
Output a list of modules compiled into the server. This will not list dynamically loaded modules included using the LoadModule directive.
-L
Output a list of directives provided by static modules, together with expected arguments and places where the directive is valid. Directives provided by shared modules are not listed.
-t
Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D DUMP_VHOSTS is also set, details of the virtual host configuration will be printed. If -D DUMP_MODULES is set, all loaded modules will be printed.
-v
Print the version of httpd, and then exit.
-V
Print the version and build parameters of httpd, and then exit.

References

  1. 1.0 1.1 man 8 'apachectl'