Configuring (all distributions)



Default configuration file: /etc/apache2/sites-available/
You will need to create a vhost in this directory, with the file ending in .conf.

For example:
/etc/apache2/sites-available/example.com.conf

Example vhost for apache

<VirtualHost *:80>
    ServerAdmin [email protected]

    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/vhosts/example.com

    <Directory /var/www/vhosts/example.com>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
</VirtualHost>


Reloading Apache Configuration

Once the vhost has been created you will need to enable the vhost using a sym-link and then reload apache for the configuration to take effect:

sudo a2ensite example.com.conf
service httpd reload