LinuxCommandLibrary

a2query

Query Apache2 configuration state

TLDR

List enabled Apache modules

$ sudo a2query -m
copy
Check if a specific module is enabled
$ sudo a2query -m [module_name]
copy
List enabled virtual hosts
$ sudo a2query -s
copy
Display the currently enabled Multi Processing Module
$ sudo a2query -M
copy
Display Apache version
$ sudo a2query -v
copy
List enabled configuration files
$ sudo a2query -c
copy

SYNOPSIS

a2query [-m [MODULE]] [-s [SITE]] [-c [CONF]] [-a] [-v] [-M] [-d] [-h]

DESCRIPTION

a2query is a Debian-specific utility designed to retrieve configuration values from a locally installed Apache2 web server. It provides a robust interface primarily intended for use in maintainer scripts but also useful for system administrators.
Arguments for -c, -m, and -s options are compared flexibly, ignoring leading mod_ prefixes and .conf or .load suffixes.

PARAMETERS

-m [MODULE]

Check whether a module is enabled; returns all enabled modules if no argument provided
-s [SITE]
Check whether a site is enabled; returns all enabled sites if no argument provided
-c [CONF]
Check if a configuration is enabled; returns all enabled configs if no argument provided
-M
Returns the current Apache2 MPM (Multi Processing Module)
-v
Returns the installed Apache2 version
-a
Displays the Apache2 Module Magic Version (API version) number
-q
Suppresses output; useful when only return codes matter
-h
Shows usage help and exits

CAVEATS

This utility is Debian-specific and not available on other Linux distributions. Exit code 32 indicates the requested module, site, or configuration was not found.

HISTORY

Created as part of the Apache2 package for Debian GNU/Linux. Written by Arno Toell.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community