a2dissite is a command-line utility that is part of the Apache HTTP Server on Linux systems. It is used to disable an Apache virtual host, which is a configuration that defines a group of settings that control how the Apache HTTP Server serves a specific website or group of websites.
To use a2dissite, you must pass it the name of the virtual host configuration file you want to disable. For example, to disable a virtual host with a configuration file named example.conf, you would run the following command:
$ sudo a2dissite example.conf
After running this command, the Apache HTTP Server will no longer serve the website or websites defined in the example.conf configuration file. To re-enable the virtual host, you can use the a2ensite command, which enables a virtual host that has been previously disabled using a2dissite.
It’s important to note that a2dissite and a2ensite only affect the availability of the virtual host. They do not delete or modify the virtual host configuration file itself. To permanently delete a virtual host, you will need to delete the configuration file and any associated files or directories.
If you encounter the below error while running the a2dissite command:
a2dissite: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install apache2 |
Ubuntu | apt-get install apache2 |
Alpine | apk add apache2 |
Kali Linux | apt-get install apache2 |
Raspbian | apt-get install apache2 |
a2dissite Command Examples
1. Disable a virtual host:
$ sudo a2dissite {{virtual_host}}
2. Don’t show informative messages:
$ sudo a2dissite --quiet {{virtual_host}}