LinuxCommandLibrary

a2dissite

Disable an Apache website configuration

TLDR

Disable a virtual host

$ sudo a2dissite [virtual_host]
copy

Don't show informative messages
$ sudo a2dissite [[-q|--quiet]] [virtual_host]
copy

SYNOPSIS

a2dissite [-q | -v] [-f] site [site...]
a2dissite -h

PARAMETERS

site
    The name of the site configuration file (without the .conf extension) to disable. Multiple sites can be specified.

-q
    Quiet: Suppress all output except errors.

-v
    Verbose: Display information about actions being taken.

-f
    Force: Do not ask for confirmation before disabling the site(s).

-h
    Help: Display usage information and exit.

DESCRIPTION

a2dissite is a script used to disable Apache virtual host configurations. It operates by removing the symbolic link from the /etc/apache2/sites-enabled/ directory that points to the configuration file in /etc/apache2/sites-available/. This effectively tells Apache to no longer load that specific site configuration upon restart or reload. This command simplifies the management of Apache virtual hosts, making it easy to turn sites on or off without manually manipulating symbolic links. After running a2dissite, the Apache web server must be reloaded or restarted for the changes to take effect. It typically requires root privileges to execute.

CAVEATS

  • Requires root privileges (e.g., using sudo) to modify system configuration files.
  • Changes do not take effect until Apache is reloaded or restarted (e.g., via sudo systemctl reload apache2 or sudo service apache2 reload).
  • Only disables the symbolic link; the actual configuration file in sites-available/ remains unchanged.

CONFIGURATION DIRECTORIES

a2dissite primarily interacts with the /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/ directories. Configuration files in sites-available/ contain the actual virtual host definitions, while sites-enabled/ contains symbolic links to the files in sites-available/ that are currently active. Disabling a site removes its link from sites-enabled/.

IMPACT ON RUNNING SERVER

Disabling a site with a2dissite does not immediately stop the site from serving requests. The changes only take effect after the Apache web server is reloaded or restarted. It is crucial to perform this subsequent step (e.g., sudo systemctl reload apache2) for the site to become inactive and for Apache to recognize the updated configuration.

HISTORY

The a2dissite script is part of the Apache HTTP Server package, predominantly found in Debian/Ubuntu-based distributions where Apache configuration is managed through a modular approach using sites-available/ and sites-enabled/ directories. Its development reflects the need for simplified administration of virtual hosts, moving away from manual symbolic link management to a command-line utility. It has been a standard tool for Apache administrators on these systems for many years, offering a consistent and convenient way to manage website configurations.

SEE ALSO

Copied to clipboard