The a2query command is a very simple and niffty tool that is used to retrieve information from the configuration of a local Apache 2 HTTP Server.
Lets see a few examples of how to use a2query.
How to list all enabled apache modules
$ a2query -m
access_compat (enabled by maintainer script)
alias (enabled by maintainer script)
auth_basic (enabled by maintainer script)
authn_core (enabled by maintainer script)
authn_file (enabled by maintainer script)
authz_core (enabled by maintainer script)
authz_host (enabled by maintainer script)
authz_user (enabled by maintainer script)
autoindex (enabled by maintainer script)
deflate (enabled by maintainer script)
dir (enabled by maintainer script)
env (enabled by maintainer script)
filter (enabled by maintainer script)
mime (enabled by maintainer script)
mpm_event (enabled by maintainer script)
negotiation (enabled by maintainer script)
reqtimeout (enabled by maintainer script)
setenvif (enabled by maintainer script)
status (enabled by maintainer script)
How to list all virtual hosts
$a2query -s
000-default (enabled by site administrator)
How to check if a module is enabled?
$a2query -m status
status (enabled by maintainer script)
How to check the enabled Apache MPM (Multi Processing Module)
$a2query -M
event
How to display the current Apache2 version
$ a2query -v
2.4.38
Note: For every successful command, a2query returns a zero (0) exit code and non-zero exit code for every unsuccessful operation.



