author: @kawam tags:#apache#linux
Apache comes with a default virtual host file called 000-default.conf that we’ll use as a template. We’ll copy it over to create a virtual host file for each of our domains.
Create the First virtual host file
Example
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>Enable the new virtual host files.
sudo a2ensite example.com.conf
sudo a2dissite 000-default.confRestart
sudo systemctl restart apache2