apachectl - Apache HTTP Server Control Interface
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.
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
.
If your Apache installation uses non-standard paths, you will need to edit the apachectl
script to set the appropriate paths to the httpd
binary. You can also specify any necessary httpd
command line arguments. See the comments in the script for details.
The apachectl
script returns a 0 exit value on success, and >0 if an error occurs. For more details, view the comments in the script.
Synopsis
When acting in pass-through mode, apachectl
can takeall the arguments available for the httpd
binary.
apachectl [ httpd-argument ]
When acting in SysV init mode, apachectl
takes simple,one-word commands, defined below.
apachectl command
Options
Only the SysV init-style options are defined here. Other argumentsare defined on the httpd
manual page.
start
- Start the Apache
httpd
daemon. Gives an error if itis already running. This is equivalent to apachectl -kstart
. stop
- Stops the Apache
httpd
daemon. This is equivalent toapachectl -k stop
. restart
- Restarts the Apache
httpd
daemon. If the daemon isnot running, it is started. This command automatically checks theconfiguration files as in configtest
before initiatingthe restart to make sure the daemon doesn't die. This is equivalentto apachectl -k restart
. fullstatus
- Displays a full status report from
mod_status
.For this to work, you need to have mod_status
enabledon your server and a text-based browser such as lynx
available on your system. The URL used to access the status reportcan be set by editing the STATUSURL
variable in thescript. status
- Displays a brief status report. Similar to the
fullstatus
option, except that the list of requestscurrently being served is omitted. graceful
- Gracefully restarts the Apache
httpd
daemon. If thedaemon is not running, it is started. This differs from a normalrestart in that currently open connections are not aborted. A sideeffect is that old log files will not be closed immediately. Thismeans that if used in a log rotation script, a substantial delay maybe necessary to ensure that the old log files are closed beforeprocessing them. This command automatically checks the configurationfiles as in configtest
before initiating therestart to make sure Apache doesn't die. This is equivalent toapachectl -k graceful
. graceful-stop
- Gracefully stops the Apache
httpd
daemon. This differs from a normal stop in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This is equivalent to apachectl -k graceful-stop
. configtest
- Run a configuration file syntax test. It parses the configurationfiles and either reports
Syntax Ok
or detailed information about the particular syntax error. This isequivalent to apachectl -t
.
The following option was available in earlier versions but has been removed.
startssl
- To start
httpd
with SSL support, you should edityour configuration file to include the relevant directives and thenuse the normal apachectl start
.