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] <name>

PARAMETERS

-q, --quiet
    Suppress output messages.

<name>
    Config snippet name (basename in conf-available/, without .conf).

DESCRIPTION

The a2disconf command is a Debian/Ubuntu-specific utility for managing Apache2 configurations. It disables a configuration snippet by removing its symlink from /etc/apache2/conf-enabled/ to the file in /etc/apache2/conf-available/. This modular system allows easy enabling/disabling without editing files or Apache's main config.

Usage typically involves specifying the config name (without .conf extension). It performs an Apache syntax check (apache2ctl -t) before disabling. No automatic reload occurs, so reload Apache manually with systemctl reload apache2 or apache2ctl graceful.

Ideal for toggling optional modules like security headers or PHP settings. Part of Apache2's admin scripts alongside a2enconf, a2ensite. Run as root/sudo; errors if config not enabled or missing.

CAVEATS

Requires root privileges (use sudo). Debian/Ubuntu only; not in upstream Apache. No auto-reload; manually reload Apache. Fails if config not enabled.

EXAMPLE

sudo a2disconf security
Disables /etc/apache2/conf-available/security.conf.

sudo a2disconf javascript-common
Then: sudo systemctl reload apache2

HISTORY

Introduced ~2008 in Debian apache2 2.2 package for modular configs. Evolved with apache2-utils; standard in Ubuntu/Debian since.

SEE ALSO

Copied to clipboard