Sites or virtual hosts are extremely useful when you are hosting more than one website on a box. I’ve already shown you how to set up virtual hosts under Apache 2, but I thought I would quickly just give a little more insight into what the a2ensite and converse a2dissite function calls do.

All that a2ensite is, is a script that enables specified sites (which contain a
block) within the apache2 configuration.

It achieves this by creating symlinks within /etc/apache2/sites-enabled. The opposite of doing this is a2dissite which disables the site by removing that symlink.

Funnily enough, you can enable or disable a site multiple times without getting an error, simply because all these scripts are doing is manipulating symlinks. Lastly, the default site is handled specially, with a resulting symlink called 000-default in order to be loaded first.

And now you know.