apache2ctl(8)

πŸ“¦
version 2.4.69 Β· 2 versions
  • 2.4.69 Β· debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute (latest)
  • 2.4.68 Β· ubuntu stonking
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute

πŸ’– apache2ctl β€” the Apache HTTP server control interface, bestie edition πŸ’–

okay so you know how apache2ctl(8) is this System Manager's Manual situation? yeah. that's what we're doing today. sit down, grab a strawberry, we're gonna run this Apache server together πŸ“βœ¨


🌸 NAME 🌸

apache2ctl β€” the Apache HTTP server control interface. that's it, that's the girl πŸ’…


✨ SYNOPSIS ✨

okay so here's the vibe: apache2ctl has two whole modes and you need to know which one you're in, bestie.

SysV init mode is when it takes simple, one-word commands (all of those are defined down below in OPTIONS, don't worry):

apachectl command
apache2ctl command

Pass-through mode is when it can take literally all the arguments available for the httpd binary. main character energy fr:

apachectl [httpd-argument]
apache2ctl [httpd-argument]

πŸ¦‹ DESCRIPTION πŸ¦‹

so apache2ctl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. it's designed to help the administrator control the functioning of the Apache apache2 daemon. it's giving personal assistant to a very powerful daemon 🫢

NOTE: the default Debian configuration requires the environment variables APACHE_RUN_USER, APACHE_RUN_GROUP, and APACHE_PID_FILE to be set in /etc/apache2/envvars. no cap, if those aren't set it's not gonna go well 😭

the apache2ctl script returns a 0 exit value on success, and >0 if an error occurs. for more details, view the comments in the script. (yes, actually go read them, they're right there πŸ’€)


πŸ’… OPTIONS πŸ’…

the command can be any one or more of the following options:

  • start β€” Starts the Apache daemon. Gives an error if it is already running. like girl we KNOW you're already up 😭
  • stop β€” Stops the Apache daemon. bye bestie πŸ‘‹
  • restart β€” Restarts the Apache daemon by sending it a SIGHUP. If the daemon is not running, it is started. This command automatically checks the configuration files via configtest before initiating the restart to catch the most obvious errors. However, it is still possible for the daemon to die because of problems with the configuration. ⚠️ so yeah, it checks, but it does not catch everything, don't get cocky
  • fullstatus β€” Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynx available on your system. The URL used to access the status report can be set by setting the APACHE_STATUSURL variable in /etc/apache2/envvars. full tea, all of it β˜•
  • status β€” Displays a brief status report. Similar to the fullstatus option, except that the list of requests currently being served is omitted. the tl;dr version 🌸
  • graceful β€” Gracefully restarts the Apache daemon by sending it a SIGUSR1. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them. This command automatically checks the configuration files via apache2ctl configtest before initiating the restart to catch the most obvious errors. However, it is still possible for the daemon to die because of problems with the configuration. 🧚 gentle queen behavior, but the log-file delay is REAL, plan for it
  • 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. same energy as above, she's leaving but she's not slamming the door πŸ’œ
  • configtest β€” Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or information about the particular syntax error. This test does not catch all errors. so it's a vibe check, not a full audit, iykyk
  • help β€” Displays a short help message. when in doubt πŸŽ€

🌈 the removed one 🌈

the following option was available in earlier versions but has been removed. she's gone, she's not coming back:

  • startssl β€” To start httpd with SSL support, you should edit your configuration file to include the relevant directives and then use the normal apache2ctl start. that's the whole move now, periodt πŸ’…

πŸŽ€ ENVIRONMENT πŸŽ€

the behaviour of apache2ctl can be influenced with these environment variables:

  • APACHE_HTTPD
  • APACHE_LYNX
  • APACHE_STATUSURL
  • APACHE_ULIMIT_MAX_FILES
  • APACHE_RUN_DIR
  • APACHE_LOCK_DIR
  • APACHE_RUN_USER
  • APACHE_ARGUMENTS
  • APACHE_ENVVARS

See the comments in the script for details. These variables (except APACHE_ENVVARS) can be set in /etc/apache2/envvars. ⭐ nine girls, one env file, iconic


πŸ”₯ SEE ALSO πŸ”₯

  • apache2(8)
  • /usr/share/doc/apache2/README.Debian.gz

this page came from the System Manager's Manual, dated April 2008, and it's literally titled apache2ctl(8). so like. vintage. a classic. ate and left no crumbs πŸ«ΆπŸ’– thanks for reading bestie, now go check your configtest before you restart anything, mwah 😘✨