LinuxCommandLibrary

a2disconf

Disable Apache configuration files

TLDR

Disable a configuration file

$ sudo a2disconf [configuration_file]
copy

Don't show informative messages
$ sudo a2disconf [[-q|--quiet]] [configuration_file]
copy

SYNOPSIS

a2disconf [-q|--quiet] conf

PARAMETERS

conf
    The name of the configuration file to disable. This should be the base name of the file (e.g., 'charset', 'security') without the .conf extension. The file must exist in /etc/apache2/conf-available/.

-q or --quiet
    Suppresses the display of informational messages about symbolic link creation or removal. Only errors will be shown.

DESCRIPTION

a2disconf is a utility script primarily used on Debian-based Linux distributions (like Ubuntu) to manage Apache HTTP Server configuration files. It provides a convenient way to disable a specific configuration file without deleting its original content. The command operates by removing the symbolic link from the /etc/apache2/conf-enabled/ directory that points to the actual configuration file located in /etc/apache2/conf-available/.

This method ensures that the original configuration file remains untouched and can be easily re-enabled later using the a2enconf command. After running a2disconf, the Apache web server must be reloaded or restarted for the changes to take effect, as the command itself does not automatically perform this action. It is commonly used by system administrators to temporarily or permanently disable specific server-wide settings, often for debugging, maintenance, or security purposes, ensuring that only actively required configurations are loaded by Apache.

CAVEATS

  • Requires sudo or root privileges to execute successfully due to file system operations in protected directories.
  • Does not automatically reload or restart the Apache HTTP Server. After running a2disconf, you must manually reload (e.g., sudo systemctl reload apache2) or restart (e.g., sudo systemctl restart apache2) Apache for the changes to take effect.
  • The command only removes the symbolic link from conf-enabled; it does not delete the original configuration file from conf-available.
  • Attempting to disable a non-existent configuration file or one that is already disabled will result in an error or a message indicating that the link does not exist.

FILE LOCATIONS

The command specifically interacts with the /etc/apache2/conf-available/ directory (where available configurations are stored) and the /etc/apache2/conf-enabled/ directory (where enabled configurations are symlinked from).

CONFIGURATION EXTENSION

The 'conf' argument should typically be provided without the .conf file extension, as the command automatically appends it when searching for the file in conf-available. For example, to disable charset.conf, you would use a2disconf charset.

HISTORY

The a2disconf command, along with its counterparts like a2enconf, a2enmod, and a2dissite, is part of the Apache utilities provided by Debian's Apache packaging. These scripts were developed to simplify the management of Apache configurations, modules, and virtual hosts in a structured and reversible manner, primarily for Debian and Ubuntu distributions. They encapsulate the manual process of creating or removing symbolic links, ensuring consistency and reducing errors. Their usage became widespread with the adoption of these distributions for web servers.

SEE ALSO

Copied to clipboard