How to a2ensite and a2dissite?

a2ensite etc. are commands available in Debian-based systems and that are not available in RH-based distributions.

What they do is to manage symbolic links from configuration file parts in /etc/apache2/sites-available and mods-available to /etc/apache2/sites-enabled and so on. E.g. if you have a vhost defined in a config file /etc/apache2/sites-avaible/example.com, a2ensite example.com would create a symlink to this file in /etc/apache2/sites-enabled and reload the apache config. The main Apache config file contains lines that include every file in /etc/apache2/sites-enabled and thus, they get incorporated into the runtime config.

It’s quite easy to mimic this structure in RHEL. Add two directories in /etc/httpd/ named sites-enabled and sites-available and add your vhosts into files in sites-available. After that, add a line

include ../sites-enabled 

to /etc/httpd/conf/httpd.conf. You can now create symlinks to sites-enabled and then reload the config with service httpd reload or apachectl.

Leave a Comment