apache2
Manage the Apache web server
SYNOPSIS
apache2 {start | stop | restart | reload | graceful | graceful-stop | configtest | status | fullstatus | version | help}
PARAMETERS
start
Starts the Apache HTTP Server.
stop
Stops the Apache HTTP Server.
restart
Restarts the Apache HTTP Server. This involves stopping and then starting the server.
reload
Reloads the Apache HTTP Server configuration without interrupting existing connections. This is done using `apachectl graceful`.
graceful
Restarts the Apache HTTP Server gracefully, allowing existing connections to complete before restarting.
graceful-stop
Stops the Apache HTTP Server gracefully, allowing existing connections to complete before stopping.
configtest
Tests the Apache HTTP Server configuration for syntax errors without starting or restarting the server.
status
Shows a brief status report.
fullstatus
Shows a full status report. Requires `mod_status` to be enabled.
version
Displays the Apache HTTP Server version information.
help
Displays a help message with available options.
DESCRIPTION
The `apache2` command is a control interface for the Apache HTTP Server. It allows you to start, stop, restart, and reload the Apache web server. It simplifies managing the Apache service and configuration on Debian-based systems.
This command provides abstractions over the lower-level systemd or init.d scripts, making it easier to manage Apache without directly interacting with those systems. It typically relies on scripts located in `/etc/init.d/apache2` or systemd unit files (e.g., `apache2.service`). It is frequently used to test changes to the configuration files or to deploy configuration changes. Correct usage is crucial for keeping the webserver online and responsive to requests. Incorrect configuration could result in service downtime or security vulnerabilities.
CAVEATS
The `apache2` command might not be available or have the exact same functionality across different Linux distributions.
The user must have sufficient privileges (usually root or sudo) to execute most of these commands.
CONFIGURATION FILES
The main Apache configuration file is typically located at `/etc/apache2/apache2.conf`. Virtual host configurations are usually found in `/etc/apache2/sites-available/` and enabled using `a2ensite`.
LOG FILES
Apache's access and error logs are commonly located in `/var/log/apache2/`.
ENABLING/DISABLING MODULES
The commands `a2enmod` and `a2dismod` are used to enable and disable Apache modules respectively. For Example: a2enmod rewrite will enable the rewrite module.
HISTORY
The `apache2` command evolved as a convenience wrapper around the underlying Apache HTTP Server control mechanisms.
Its development aimed to provide a consistent interface for managing the Apache service on Debian-based systems, abstracting away the differences between init.d scripts and systemd.
SEE ALSO
apachectl(8), httpd(8)