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 | --quiet] [-h | --help] <sitename> [<sitename> ...]

PARAMETERS

-q, --quiet
    Suppress informative startup and status messages

-h, --help
    Display usage information and exit

DESCRIPTION

a2dissite is a convenience script for the Apache2 web server on Debian-based Linux distributions like Ubuntu. It disables virtual host site configurations by removing symbolic links from the /etc/apache2/sites-enabled/ directory to the corresponding files in /etc/apache2/sites-available/. This effectively stops Apache from loading those site configurations without deleting the original files, allowing easy re-enabling later.

Typically used with sudo due to requiring root privileges to modify system directories. After running a2dissite, reload or restart Apache (e.g., sudo systemctl reload apache2) for changes to take effect. Site names match the basename of config files in sites-available, such as 000-default or example.com. Multiple sites can be disabled in one command.

It integrates with Apache's modular configuration system, promoting safe management of multiple websites on a single server. Ideal for development, staging, or temporarily taking sites offline.

CAVEATS

Requires root privileges (use sudo); always reload Apache afterward; site must exist in sites-available; no confirmation prompt in quiet mode.

USAGE EXAMPLE

sudo a2dissite 000-default
sudo systemctl reload apache2

HOW IT WORKS

Removes symlink: /etc/apache2/sites-enabled/example.com/etc/apache2/sites-available/example.com

HISTORY

Introduced in Debian's apache2 package around 2004 with Apache 2.0/2.2 transition; maintained for easy site management in modern versions up to Apache 2.4.

SEE ALSO

a2ensite(8), a2dismod(8), a2enmod(8), apache2(8)

Copied to clipboard