LinuxCommandLibrary

a2query

Check if Apache module is enabled

TLDR

List enabled Apache modules

$ sudo a2query -m
copy

Check if a specific module is installed
$ 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

SYNOPSIS

a2query module_name

PARAMETERS

module_name
    The name of the Apache 2 module to query.

DESCRIPTION

The `a2query` command is a utility used to query the status of Apache 2 modules. It helps determine whether a specific module is currently enabled or disabled within the Apache 2 web server configuration. This tool is crucial for administrators and developers who need to quickly ascertain the state of modules without manually inspecting configuration files. It streamlines the process of managing and troubleshooting Apache 2 configurations.

The command's main functionality lies in checking if a given module is available and active. Unlike directly parsing configuration files which can be cumbersome, `a2query` provides a simple and efficient way to get the module status. It essentially parses the Apache 2 configuration to extract this information.

Usage of `a2query` is fairly simple, typically involving the command name followed by the module name you wish to query. The output provides feedback on whether the specified module is currently enabled or disabled. This tool is indispensable for system administrators to ensure correct module configurations.

CAVEATS

The `a2query` command relies on the Apache 2 configuration files being properly structured. If configurations are heavily customized or non-standard, `a2query` might not accurately reflect the module's status. It only reflects enabled status, not if the module's code is present on the system.

EXIT STATUS

The `a2query` command returns an exit status of 0 if the module is enabled, and a non-zero exit status if the module is disabled or not found.

OUTPUT

The output is typically one of two options.
If enabled it displays module_name is enabled, otherwise it does not display anything and returns an error.

HISTORY

The `a2query` command was developed as part of the Apache 2 utility suite to simplify the management of Apache modules. It provides a more user-friendly alternative to manually editing Apache configuration files. Usage evolved as a key command to verify module status after enabling/disabling modules

SEE ALSO

a2enmod(8), a2dismod(8), apache2(8)

Copied to clipboard