The Apache web server has the ability to serve multiple websites from the same IP address, using virtual hosts. Each Virtual Host can be configured in the main server configuration file, or, thanks to the Include
or the IncludeOptional
directives, in its own dedicated one. When the number of virtual hosts increases, their management starts to become troublesome. If their configuration is quite similar, we can manage them dynamically, thanks to the mod_vhost_alias
module.
This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-manage-dynamic-virtual-hosts-with-apache-and-the-mod-vhost-alias-module