Apache: Create Virtual Host Files

Create a virtual host file for each site:

sudo vim /etc/apache2/sites-available/example.com.conf

Add the following content:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/example.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Leave a Reply

Your email address will not be published. Required fields are marked *