Setting up multisite on Debian 8 using virtual hosts

This post is about:

  • Debian 8
  • Apache 2


Configure the first website of your multisite installation (assuming that your website's files are located at /var/www/

1. Create a config file for your first website:

sudo nano /etc/apache2/sites-available/

'.conf' part is important!

Alternatively you could copy default config file:

cp 000-default.conf

Add/modify the content of the file to be:

# (/etc/apache2/sites-available/
<VirtualHost *:80>
    ServerAlias *
    DocumentRoot /var/www/
    RewriteEngine On
    RewriteOptions inherit

    # Logfiles
    ErrorLog  /var/www/
    CustomLog /var/www/ combined

Save the file.

2. Activate the host:

sudo a2ensite

3. Check the Apache config syntax to prevent it from crashing in case you made a mistake in configuration:

sudo apache2ctl configtest

4. If the status is OK, restart Apache:

sudo service apache2 restart


Create such a config file for every website in your multisite install.


Other posts in the series: