VMware ESXi and vSphere Cluster Management

Apache /etc/apache2/conf-available Directory

Learn how Debian and Ubuntu use /etc/apache2/conf-available and conf-enabled to manage Apache configuration snippets with a2enconf, a2disconf, configtest, and reload workflows.

On Debian and Ubuntu systems, /etc/apache2/conf-available/ stores optional Apache configuration snippets. These are focused configuration files for server-wide policies, local customizations, integrations, or specialized features.

A file in this directory is available to Apache but is not automatically active. It must be enabled before Apache reads it through the Debian and Ubuntu Apache include structure.

What Is /etc/apache2/conf-available?

A configuration snippet is a focused Apache configuration file containing settings for a particular feature, policy, integration, or local customization. For example, a snippet might define security headers, a server-wide access rule, or settings installed by another application.

The /etc/apache2/conf-available/ directory is the repository for these optional snippets. Package-installed applications may place Apache configuration files there so administrators can choose when to activate them.

Configuration snippets are generally intended for:

  • Global settings that apply across the Apache server.
  • Local policies and administrative customizations.
  • Specialized integrations installed by packages or applications.
  • Reusable settings that do not belong to one particular virtual host.

They are usually not the correct location for a domain-specific virtual host or for configuration that belongs specifically to an Apache module.

Available Versus Enabled Configuration

The related directory /etc/apache2/conf-enabled/ contains the configuration entries that are currently enabled. Its entries are normally symbolic links: filesystem references that point to selected files in conf-available.

/etc/apache2/conf-available/
└── local-security.conf              source snippet

/etc/apache2/conf-enabled/
└── local-security.conf -> ../conf-available/local-security.conf

The presence of local-security.conf in conf-available alone does not make its directives active. Apache reads enabled snippets through the main Apache configuration's include structure. In practice, the enabled link makes the snippet part of the configuration Apache loads.

This separation provides a simple administrative model:

  • Available: the configuration exists and can be enabled.
  • Enabled: a link exposes that configuration to Apache's active include structure.

Enabling a Configuration Snippet

Use a2enconf to enable a configuration by its basename. The utility creates or manages the corresponding symbolic link in conf-enabled.

sudo a2enconf local-security

For example, if the source file is /etc/apache2/conf-available/local-security.conf, the usual command is given the name local-security, without the .conf suffix.

After enabling a snippet, validate the complete Apache configuration and then reload Apache:

sudo apache2ctl configtest
sudo systemctl reload apache2

A successful syntax test commonly reports Syntax OK. Do not reload until configuration errors have been corrected.

Disabling a Configuration Snippet

Use a2disconf to disable a configuration:

sudo a2disconf local-security

Disabling normally removes the active symbolic link from conf-enabled; it does not necessarily delete the original file from conf-available. The source can therefore remain available for later use.

sudo apache2ctl configtest
sudo systemctl reload apache2

If a reload is insufficient for a particular change or operational situation, restart the service instead:

sudo systemctl restart apache2

Useful Inspection Commands

List the source snippets and their file metadata:

ls -l /etc/apache2/conf-available/

List the enabled entries and inspect their link targets:

ls -l /etc/apache2/conf-enabled/

A link in conf-enabled with a target under conf-available shows that the corresponding snippet is enabled. Comparing both directories helps distinguish an inactive source file from an active configuration.

Choosing the Correct Apache Configuration Directory

Directory pairPrimary purposeWhat is stored in the available directoryHow it becomes enabled
conf-available and conf-enabledGeneral, global, local, or specialized Apache snippetsOptional configuration files such as policies, integrations, and server-wide settingsa2enconf creates or manages a symbolic link in conf-enabled
mods-available and mods-enabledApache module managementModule loading files and module-specific configurationModule helper commands such as a2enmod manage enabled links
sites-available and sites-enabledVirtual-host website configurationDomain- or site-specific virtual-host filesSite helper commands such as a2ensite manage enabled links

Use conf-available when the setting is reusable, server-wide, or not tied to one virtual host. Use sites-available when defining a domain-specific virtual host. Use mods-available when the file exists to load or configure an Apache module.

Safe Configuration Management Workflow

  1. Create or install the snippet in /etc/apache2/conf-available/.
  2. Enable it with sudo a2enconf <configuration-name>.
  3. Validate the complete configuration with sudo apache2ctl configtest.
  4. Reload Apache with sudo systemctl reload apache2 after a successful test.
  5. When the setting is no longer needed, run sudo a2disconf <configuration-name>.
  6. Test again and reload Apache after disabling it.

Example source path:

/etc/apache2/conf-available/local-security.conf

Example workflow:

sudo a2enconf local-security
sudo apache2ctl configtest
sudo systemctl reload apache2

# Later, disable it without normally deleting the source file:
sudo a2disconf local-security
sudo apache2ctl configtest
sudo systemctl reload apache2

Troubleshooting

A file exists but its settings have no effect

  • Check whether a matching symbolic link exists in /etc/apache2/conf-enabled/.
  • If it is absent, run sudo a2enconf <configuration-name>.
  • Run sudo apache2ctl configtest.
  • Reload Apache if the test succeeds.

Apache fails to reload

Run:

sudo apache2ctl configtest

The output usually identifies an invalid directive, syntax error, or file location. Common causes include invalid Apache syntax, a directive provided by a module that is not enabled, or conflicting settings in another enabled file. Review service status and logs when the syntax test does not explain the failure:

sudo systemctl status apache2

Confirm that required modules are enabled and correct conflicting directives before attempting another reload.

a2enconf cannot find the configuration

  • Check the spelling of the configuration name.
  • List /etc/apache2/conf-available/ to verify that the file is there.
  • Use the expected basename, typically without the .conf suffix.
ls -l /etc/apache2/conf-available/
sudo a2enconf local-security

A setting remains active after editing or removing a source file

  • Reload Apache after editing the file.
  • Inspect conf-enabled with ls -l to verify link targets.
  • Search enabled configuration files for a second definition of the same directive.
  • Run apache2ctl configtest and reload after correcting the configuration.

If an enabled symbolic link points to an unexpected target, correct the enablement state with a2enconf or a2disconf rather than leaving an obsolete link in place.

Distribution Scope

/etc/apache2/conf-available, /etc/apache2/conf-enabled, a2enconf, and a2disconf are Debian and Ubuntu conventions for organizing Apache configuration. Other Linux distributions may use different paths, helper commands, and include mechanisms. Always check the layout and service-management conventions of the distribution you are administering.

Key Points

  • conf-available stores optional Apache configuration snippets.
  • conf-enabled contains symbolic links for snippets Apache should load.
  • Use a2enconf to enable and a2disconf to disable snippets.
  • Test with sudo apache2ctl configtest before reloading or restarting Apache.
  • Use sites-available for virtual hosts and mods-available for module-related configuration.

See also: Apache conf-available directory reference.