LinuxCommandLibrary

a2enconf

Enable Apache configuration files

TLDR

Enable a configuration file

$ sudo a2enconf [configuration_file]
copy

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

SYNOPSIS

a2enconf [conf-file]

PARAMETERS

conf-file
    Name of config file in conf-available/ (omit .conf extension)

-q, --quiet
    Suppress status and informative output

-l, --list
    List available configs (also runs without arguments)

DESCRIPTION

a2enconf is a Debian/Ubuntu-specific script from the apache2 package for enabling Apache2 configuration files. It operates on the modular directory structure: files in /etc/apache2/conf-available/ are activated by creating symbolic links in /etc/apache2/conf-enabled/. This allows easy toggling of config snippets like security headers, PHP settings, or modules without altering core files.

Invoke with a conf name (e.g., security for security.conf) to enable it, checking existence and avoiding duplicates. Without arguments, it lists available files with usage hints. Post-enablement, reload Apache via systemctl reload apache2 or apachectl graceful.

Part of Apache2's enable/disable suite (a2ensite, a2enmod), it ensures configs load only when symlinked, promoting clean management. Requires root (sudo). Errors if file missing or syntax invalid on reload.

CAVEATS

Requires root privileges (use sudo). Does not auto-reload Apache2; manually run systemctl reload apache2. Fails if conf-file missing, already enabled, or invalid syntax. Only for Debian/Ubuntu Apache2 setups.

DIRECTORIES

/etc/apache2/conf-available/: source configs.
/etc/apache2/conf-enabled/: active symlinks.

EXAMPLE

sudo a2enconf security
Enables security.conf.
sudo systemctl reload apache2
Applies changes.

HISTORY

Introduced ~2005 in Debian apache2 package (version 1.4+) for symlink-based modular configs, replacing flat-file management.

SEE ALSO

Copied to clipboard