Follow steps below to setup multiple virtual hosts on Apache 2.4
Step 1
Create a new file as /etc/apache2/sites-available/aaa.com.conf to represent the virtual host configuration. In this file, you can write the detail of the virtual host setting like
<VirtualHost www.aaa.com:80>
ServerAdmin admin@aaa.com
DocumentRoot "/var/www/aaa"
ServerName aaa.com
ServerAlias www.aaa.com
UseCanonicalName Off
ErrorLog "${APACHE_LOG_DIR}/aaa.com-error.log"
CustomLog ${APACHE_LOG_DIR}/aaa.com combined
DirectoryIndex index.php
</VirtualHost>
Step 2
Enable the virtual host using a2ensite command.
a2ensite aaa.com
Step 3
Restart Apache
systemctl restart apache2