Multisite in Drupal 8


  1. Setting up default main/root Drupal site- “”
  2. Setting a sub-site “”
    • Prerequisites
      • Creating a staging folder
      • Creating settings.php
      • Creating a sites.php file
  3. Adding a virtual host entry for both main and staging site
    • Adding virtual host entries
    • Enable the site
    • Add entry in /etc/hosts file
  4. Restart Apache
  5. Setting up “” site
  1. Setting up default main/root Drupal site- “”

Setup a root site which should be a normal Drupal installation (while setting a fresh root site you can also follow virtual host steps mentioned in this article)

2. Setting a sub-site “”

After the root site is set up, you can begin configuring first site called staging.

Here are the steps in this process:

i. Creating a staging folder
Create a folder for staging in your multisite: /domain/sites/

Create a database for staging, ex: domainstaging

ii. Creating settings.php
Copy domain/sites/default/default.settings.php to the new site’s directory as settings.php:

iii. Creating sites.php
Make a copy of /domain/sites/example.sites.php called /domain/sites/sites.php

Edit sites.php so the end of the file looks like this:

# make the root drupal site aware of staging site:

$sites[‘’] = ‘’;

3. Adding virtual host entry for both main and staging site

Adding virtual host entries

This can be followed for all the sub-sites like staging in our case.
Create a new domain.conf file in /etc/apache2/sites-available directory

Following is the minimum virtual host entry in the above conf file-

<virtualhost *:80>
# Admin email, Server Name (domain name) and any aliases

# Index file and Document Root (where the public files are located)

DirectoryIndex index.html
DocumentRoot /var/www/html/domain
<Directory “/var/www/html/domain”>
allow from all
order allow,deny

# Custom log file locations

#LogLevel warn
ErrorLog  /var/www/vhosts/
CustomLog /var/www/vhosts/ combined

Enable the site

/etc/apache2/sites-available$ a2ensite
/etc/apache2/sites-available$ a2ensite

Add new host entry in hosts file found at /etc/hosts

4. Restart Apache

service apache2 restart

5. Setting up “”

Create a new database for staging site.
After creating virtual host entry, go to- and install the drupal site

Both comments and pings are currently closed.

Comments are closed.