When one of the latest critical security updates for Drupal came out, I realized that I had neglected my website infrastructure quite a bit. I had multiple instances of Drupal running and all of them were out of date in one way or the other: either modules or even the core needed updates. My Drupal instances were configured in a very similar fashion, but due to them being separate instances, I had to install the same updates multiple times.
Upgrading the core from Drupal 7.x to Drupal 8.x also would have to be done multiple times. So it was time to change the infrastructure to ease the pain and avoid future vulnerabilities. Luckily Drupal has you covered there with a Multisite Drupal Setup.
It is really easy to setup. Instead of having Webserver configuration pointing into different directories with separate Drupal instances, all point to one folder. Inside the sites subfolder a sites.php file needs to be created (copy from example.sites.php file) and it will contain the site to folder mapping.
$sites['test1.localhost.com'] = 'test1.localhost.com'; $sites['test2.localhost.com'] = 'test2.localhost.com';
Next step is to create the following folders in /drupal/sites :
test1.localhost.com</code><br/><code>test2.localhost.com
After above configurations the default settings sites/default/default.settings.php are copied into sites/subsite/settings.php. After that just run the install routine for each of the sites and provide database info, etc.
test1.localhost.com/core/install.php
test2.localhost.com/core/install.php
There are different ways of setting up the folder structure. I decided to go with one central modules and theme folder, that is shared by all sites, while the image uploads, etc. are stored per site.