Apache can be configured to host multiple websites on a single server by using virtual hosts. Virtual hosts allow you to define separate configurations for different websites, each with its own domain name, IP address, and content.
Here's how to configure multiple sites with Apache:
1. Make a Directory for Each Site
mkdir -p /var/www/domain.com/public_html
mkdir -p /var/www/domain2.com/public_html
2. Set Folder Permissions
chmod -R 755 /var/www
3. Copy the Config File for Each Site
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf
4. Edit the Config File for Each Site
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain.id
ServerAlias www.domain.id
DocumentRoot /var/www/html/web_angular/dist/webapp
ErrorDocument 404 /
</VirtualHost>
5. Edit the Config File for Each Site
a2dissite 000-default.conf
To have your server mapped to your domains you’ll need to enable each of your newly made .conf files.
a2ensite domain.com.conf
a2ensite domain2.com.conf
We restart the Apache service to register our changes.
systemctl restart apache2